void-packages/srcpkgs/curlftpfs/patches/curlftpfs-0.9.2-memleak-cached#591299.patch
Đoàn Trần Công Danh c987560802 srcpkgs/c*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

53 lines
1.5 KiB
Diff

--- a/cache.c
+++ b/cache.c
@@ -25,7 +25,7 @@ struct cache {
time_t last_cleaned;
};
-static struct cache cache;
+struct cache cache;
struct node {
struct stat stat;
--- a/ftpfs-ls.c
+++ b/ftpfs-ls.c
@@ -25,6 +25,13 @@
#include "charset_utils.h"
#include "ftpfs-ls.h"
+struct cache {
+ int on;
+ char incomplete[];
+};
+
+extern struct cache cache;
+
static int parse_dir_unix(const char *line,
struct stat *sbuf,
char *file,
@@ -243,8 +250,10 @@ int parse_dir(const char* list, const ch
reallink = g_strdup(link);
}
int linksize = strlen(reallink);
- cache_add_link(full_path, reallink, linksize+1);
- DEBUG(1, "cache_add_link: %s %s\n", full_path, reallink);
+ if (cache.on) {
+ cache_add_link(full_path, reallink, linksize+1);
+ DEBUG(1, "cache_add_link: %s %s\n", full_path, reallink);
+ }
if (linkbuf && linklen) {
if (linksize > linklen) linksize = linklen - 1;
strncpy(linkbuf, reallink, linksize);
@@ -257,8 +266,10 @@ int parse_dir(const char* list, const ch
DEBUG(1, "filler: %s\n", file);
filler(h, file, &stat_buf);
} else {
- DEBUG(1, "cache_add_attr: %s\n", full_path);
- cache_add_attr(full_path, &stat_buf);
+ if (cache.on) {
+ DEBUG(1, "cache_add_attr: %s\n", full_path);
+ cache_add_attr(full_path, &stat_buf);
+ }
}
DEBUG(2, "comparing %s %s\n", name, file);