Changeset View
Changeset View
Standalone View
Standalone View
files/0001-fusermount-Support-a-stateless-configuration.patch
| From a50938bc42da56b8e49b57969d371c064207af36 Mon Sep 17 00:00:00 2001 | From 3f627492c2b57a0b6d510ce770461f841f5c568f Mon Sep 17 00:00:00 2001 | ||||
| From: Pierre-Yves <pyu@riseup.net> | From: "F. von Gellhorn" <flinux@vongellhorn.ch> | ||||
| Date: Tue, 24 Jul 2018 16:07:04 +0200 | Date: Sun, 25 Apr 2021 20:02:00 +0200 | ||||
| Subject: [PATCH] fusermount: Support a stateless configuration | Subject: [PATCH 1/1] fusermount: Support a stateless configuration | ||||
| Signed-off-by: Pierre-Yves <pyu@riseup.net> | |||||
| --- | --- | ||||
| util/fusermount.c | 25 +++++++++++++++++-------- | util/fusermount.c | 23 +++++++++++++++-------- | ||||
| 1 file changed, 17 insertions(+), 8 deletions(-) | 1 file changed, 15 insertions(+), 8 deletions(-) | ||||
| diff --git a/util/fusermount.c b/util/fusermount.c | diff --git a/util/fusermount.c b/util/fusermount.c | ||||
| index 245aeea..e2f6d91 100644 | index e738dbd..08498b5 100644 | ||||
| --- a/util/fusermount.c | --- a/util/fusermount.c | ||||
| +++ b/util/fusermount.c | +++ b/util/fusermount.c | ||||
| @@ -38,6 +38,7 @@ | @@ -35,6 +35,7 @@ | ||||
| #define FUSE_DEV_NEW "/dev/fuse" | #define FUSE_COMMFD_ENV "_FUSE_COMMFD" | ||||
| #define FUSE_VERSION_FILE_OLD "/proc/fs/fuse/version" | |||||
| #define FUSE_CONF "/etc/fuse.conf" | #define FUSE_DEV "/dev/fuse" | ||||
| +#define SYSTEM_FUSE_CONF "/usr/share/defaults/fuse/fuse.conf" | +#define SYSTEM_FUSE_CONF "/usr/share/defaults/fuse/fuse.conf" | ||||
| #ifndef MS_DIRSYNC | #ifndef MS_DIRSYNC | ||||
| #define MS_DIRSYNC 128 | #define MS_DIRSYNC 128 | ||||
| @@ -527,7 +528,7 @@ static void strip_line(char *line) | @@ -532,7 +533,7 @@ static void strip_line(char *line) | ||||
| memmove(line, s, strlen(s)+1); | memmove(line, s, strlen(s)+1); | ||||
| } | } | ||||
| -static void parse_line(char *line, int linenum) | -static void parse_line(char *line, int linenum) | ||||
| +static void parse_line(char *conf_file, char *line, int linenum) | +static void parse_line(char *conf_file, char *line, int linenum) | ||||
| { | { | ||||
| int tmp; | int tmp; | ||||
| if (strcmp(line, "user_allow_other") == 0) | if (strcmp(line, "user_allow_other") == 0) | ||||
| @@ -537,12 +538,20 @@ static void parse_line(char *line, int linenum) | @@ -542,12 +543,18 @@ static void parse_line(char *line, int linenum) | ||||
| else if(line[0]) | else if(line[0]) | ||||
| fprintf(stderr, | fprintf(stderr, | ||||
| "%s: unknown parameter in %s at line %i: '%s'\n", | "%s: unknown parameter in %s at line %i: '%s'\n", | ||||
| - progname, FUSE_CONF, linenum, line); | - progname, FUSE_CONF, linenum, line); | ||||
| + progname, conf_file, linenum, line); | + progname, conf_file, linenum, line); | ||||
| } | } | ||||
| static void read_conf(void) | static void read_conf(void) | ||||
| { | { | ||||
| - FILE *fp = fopen(FUSE_CONF, "r"); | - FILE *fp = fopen(FUSE_CONF, "r"); | ||||
| + const char *fuse_conf = NULL; | + const char *fuse_conf = NULL; | ||||
| + | |||||
| + if (access(FUSE_CONF, F_OK) == 0) { | + if (access(FUSE_CONF, F_OK) == 0) { | ||||
| + fuse_conf = FUSE_CONF; | + fuse_conf = FUSE_CONF; } | ||||
| + } else { | + else { | ||||
| + fuse_conf = SYSTEM_FUSE_CONF; | + fuse_conf = SYSTEM_FUSE_CONF; } | ||||
| + } | |||||
| + | + | ||||
| + FILE *fp = fopen(fuse_conf, "r"); | + FILE *fp = fopen(fuse_conf, "r"); | ||||
| if (fp != NULL) { | if (fp != NULL) { | ||||
| int linenum = 1; | int linenum = 1; | ||||
| char line[256]; | char line[256]; | ||||
| @@ -551,12 +560,12 @@ static void read_conf(void) | @@ -556,12 +563,12 @@ static void read_conf(void) | ||||
| if (isnewline) { | if (isnewline) { | ||||
| if (line[strlen(line)-1] == '\n') { | if (line[strlen(line)-1] == '\n') { | ||||
| strip_line(line); | strip_line(line); | ||||
| - parse_line(line, linenum); | - parse_line(line, linenum); | ||||
| + parse_line(fuse_conf, line, linenum); | + parse_line(fuse_conf, line, linenum); | ||||
| } else { | } else { | ||||
| isnewline = 0; | isnewline = 0; | ||||
| } | } | ||||
| } else if(line[strlen(line)-1] == '\n') { | } else if(line[strlen(line)-1] == '\n') { | ||||
| - fprintf(stderr, "%s: reading %s: line %i too long\n", progname, FUSE_CONF, linenum); | - fprintf(stderr, "%s: reading %s: line %i too long\n", progname, FUSE_CONF, linenum); | ||||
| + fprintf(stderr, "%s: reading %s: line %i too long\n", progname, fuse_conf, linenum); | + fprintf(stderr, "%s: reading %s: line %i too long\n", progname, fuse_conf, linenum); | ||||
| isnewline = 1; | isnewline = 1; | ||||
| } | } | ||||
| @@ -564,11 +573,11 @@ static void read_conf(void) | @@ -569,11 +576,11 @@ static void read_conf(void) | ||||
| linenum ++; | linenum ++; | ||||
| } | } | ||||
| if (!isnewline) { | if (!isnewline) { | ||||
| - fprintf(stderr, "%s: reading %s: missing newline at end of file\n", progname, FUSE_CONF); | - fprintf(stderr, "%s: reading %s: missing newline at end of file\n", progname, FUSE_CONF); | ||||
| + fprintf(stderr, "%s: reading %s: missing newline at end of file\n", progname, fuse_conf); | + fprintf(stderr, "%s: reading %s: missing newline at end of file\n", progname, fuse_conf); | ||||
| } | } | ||||
| if (ferror(fp)) { | if (ferror(fp)) { | ||||
| - fprintf(stderr, "%s: reading %s: read failed\n", progname, FUSE_CONF); | - fprintf(stderr, "%s: reading %s: read failed\n", progname, FUSE_CONF); | ||||
| + fprintf(stderr, "%s: reading %s: read failed\n", progname, fuse_conf); | + fprintf(stderr, "%s: reading %s: read failed\n", progname, fuse_conf); | ||||
| exit(1); | exit(1); | ||||
| } | } | ||||
| fclose(fp); | fclose(fp); | ||||
| @@ -577,7 +586,7 @@ static void read_conf(void) | @@ -582,7 +589,7 @@ static void read_conf(void) | ||||
| errno != ENAMETOOLONG && errno != ENOTDIR && | errno != ENAMETOOLONG && errno != ENOTDIR && | ||||
| errno != EOVERFLOW); | errno != EOVERFLOW); | ||||
| fprintf(stderr, "%s: failed to open %s: %s\n", | fprintf(stderr, "%s: failed to open %s: %s\n", | ||||
| - progname, FUSE_CONF, strerror(errno)); | - progname, FUSE_CONF, strerror(errno)); | ||||
| + progname, fuse_conf, strerror(errno)); | + progname, fuse_conf, strerror(errno)); | ||||
| if (fatal) | if (fatal) | ||||
| exit(1); | exit(1); | ||||
| } | } | ||||
| -- | -- | ||||
| 2.18.0 | 2.30.2 | ||||
Copyright © 2015-2021 Solus Project. The Solus logo is Copyright © 2016-2021 Solus Project. All Rights Reserved.