diff options
Diffstat (limited to 'src/firecfg')
-rw-r--r-- | src/firecfg/main.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/firecfg/main.c b/src/firecfg/main.c index 1cdd39c1f..090905a85 100644 --- a/src/firecfg/main.c +++ b/src/firecfg/main.c | |||
@@ -91,7 +91,8 @@ static void list(void) { | |||
91 | free(firejail_exec); | 91 | free(firejail_exec); |
92 | } | 92 | } |
93 | 93 | ||
94 | static void clear(void) { | 94 | static void clean(void) { |
95 | printf("Removing all firejail symlinks:\n"); | ||
95 | if (getuid() != 0) { | 96 | if (getuid() != 0) { |
96 | fprintf(stderr, "Error: you need to be root to run this command\n"); | 97 | fprintf(stderr, "Error: you need to be root to run this command\n"); |
97 | exit(1); | 98 | exit(1); |
@@ -120,8 +121,11 @@ static void clear(void) { | |||
120 | char* fname = realpath(fullname, NULL); | 121 | char* fname = realpath(fullname, NULL); |
121 | if (fname) { | 122 | if (fname) { |
122 | if (strcmp(fname, firejail_exec) == 0) { | 123 | if (strcmp(fname, firejail_exec) == 0) { |
123 | printf("%s removed\n", fullname); | 124 | char *ptr = strrchr(fullname, '/'); |
125 | assert(ptr); | ||
126 | ptr++; | ||
124 | unlink(fullname); | 127 | unlink(fullname); |
128 | printf(" %s removed\n", ptr); | ||
125 | } | 129 | } |
126 | free(fname); | 130 | free(fname); |
127 | } | 131 | } |
@@ -131,6 +135,7 @@ static void clear(void) { | |||
131 | 135 | ||
132 | closedir(dir); | 136 | closedir(dir); |
133 | free(firejail_exec); | 137 | free(firejail_exec); |
138 | printf("\n"); | ||
134 | } | 139 | } |
135 | 140 | ||
136 | static void set_file(const char *name, const char *firejail_exec) { | 141 | static void set_file(const char *name, const char *firejail_exec) { |
@@ -283,7 +288,7 @@ int main(int argc, char **argv) { | |||
283 | return 0; | 288 | return 0; |
284 | } | 289 | } |
285 | else if (strcmp(argv[i], "--clean") == 0) { | 290 | else if (strcmp(argv[i], "--clean") == 0) { |
286 | clear(); | 291 | clean(); |
287 | return 0; | 292 | return 0; |
288 | } | 293 | } |
289 | else if (strcmp(argv[i], "--fix") == 0) { | 294 | else if (strcmp(argv[i], "--fix") == 0) { |
@@ -340,6 +345,7 @@ int main(int argc, char **argv) { | |||
340 | } | 345 | } |
341 | } | 346 | } |
342 | } | 347 | } |
348 | clean(); | ||
343 | set_links_firecfg(); | 349 | set_links_firecfg(); |
344 | 350 | ||
345 | 351 | ||