]> git.pld-linux.org Git - packages/wget.git/blob - user.xdg.origin.url.patch
fix build with gnupg >= 2.4.1; rel 2
[packages/wget.git] / user.xdg.origin.url.patch
1 in upstream now:
2 http://git.savannah.gnu.org/cgit/wget.git/commit/?id=a933bdd31eee9c956a3b5cc142f004ef1fa94cb3
3
4 From 2c968b81d9d9c4025379242b5f560aab441e1430 Mon Sep 17 00:00:00 2001
5 From: =?UTF-8?q?Mantas=20Mikul=C4=97nas?= <grawity@gmail.com>
6 Date: Sat, 7 Dec 2013 20:45:00 +0200
7 Subject: [PATCH] Set the 'user.xdg.origin.url' xattr for downloaded files
8
9 ---
10  src/ftp.c  |  2 ++
11  src/http.c |  2 ++
12  src/url.c  | 20 ++++++++++++++++++++
13  src/url.h  |  4 ++++
14  4 files changed, 28 insertions(+)
15
16 diff -urNp -x '*.orig' wget-1.21.1.org/src/ftp.c wget-1.21.1/src/ftp.c
17 --- wget-1.21.1.org/src/ftp.c   2021-01-08 23:51:43.000000000 +0100
18 +++ wget-1.21.1/src/ftp.c       2021-05-06 00:07:54.231635623 +0200
19 @@ -1534,6 +1534,8 @@ Error in server response, closing contro
20    else
21      fp = output_stream;
22  
23 +  set_xa (u, fileno(fp));
24 +
25    if (passed_expected_bytes)
26      {
27        print_length (passed_expected_bytes, restval, true);
28 diff -urNp -x '*.orig' wget-1.21.1.org/src/http.c wget-1.21.1/src/http.c
29 --- wget-1.21.1.org/src/http.c  2021-01-08 23:51:43.000000000 +0100
30 +++ wget-1.21.1/src/http.c      2021-05-06 00:07:54.232635623 +0200
31 @@ -4181,6 +4181,8 @@ gethttp (const struct url *u, struct url
32      }
33  #endif
34  
35 +  set_xa (u, fileno(fp));
36 +
37    err = read_response_body (hs, sock, fp, contlen, contrange,
38                              chunked_transfer_encoding,
39                              u->url, warc_timestamp_str,
40 diff -urNp -x '*.orig' wget-1.21.1.org/src/url.c wget-1.21.1/src/url.c
41 --- wget-1.21.1.org/src/url.c   2021-01-08 23:51:43.000000000 +0100
42 +++ wget-1.21.1/src/url.c       2021-05-06 00:07:54.233635623 +0200
43 @@ -36,6 +36,7 @@ as that of the covered work.  */
44  #include <unistd.h>
45  #include <errno.h>
46  #include <assert.h>
47 +#include <sys/xattr.h>
48  
49  #include "utils.h"
50  #include "url.h"
51 @@ -2382,6 +2383,25 @@ are_urls_equal (const char *u1, const ch
52    return (*p == 0 && *q == 0 ? true : false);
53  }
54  
55 +int
56 +set_xa (const struct url *origin, int fd)
57 +{
58 +  const char *url;
59 +  int res;
60 +
61 +  url = url_string(origin, URL_AUTH_HIDE);
62 +  res = fsetxattr(fd, XA_ORIGIN, url, strlen(url), 0);
63 +  if (res != 0)
64 +    {
65 +      if (errno == ENOTSUP || errno == EPERM)
66 +        res = 0;
67 +      else
68 +        logprintf (LOG_NOTQUIET, "fsetxattr: %s\n", strerror (errno));
69 +    }
70 +
71 +  return res;
72 +}
73 +
74  #ifdef TESTING
75  /* Debugging and testing support for path_simplify. */
76  
77 diff -urNp -x '*.orig' wget-1.21.1.org/src/url.h wget-1.21.1/src/url.h
78 --- wget-1.21.1.org/src/url.h   2021-01-08 23:51:43.000000000 +0100
79 +++ wget-1.21.1/src/url.h       2021-05-06 00:07:54.233635623 +0200
80 @@ -133,4 +133,8 @@ bool schemes_are_similar_p (enum url_sch
81  
82  bool are_urls_equal (const char *u1, const char *u2);
83  
84 +#define XA_ORIGIN "user.xdg.origin.url"
85 +
86 +int set_xa (const struct url *, int);
87 +
88  #endif /* URL_H */
This page took 0.037621 seconds and 3 git commands to generate.