aboutsummaryrefslogtreecommitdiffstats
path: root/src/firecfg
diff options
context:
space:
mode:
authorLibravatar Fred-Barclay <Fred-Barclay@users.noreply.github.com>2017-11-19 15:02:42 -0600
committerLibravatar Fred-Barclay <Fred-Barclay@users.noreply.github.com>2017-11-19 15:02:42 -0600
commitb936e5ab77dfa0b54b2f6f6dd53762a8244e4230 (patch)
treeedb7237ba54d7c2a85a8531c8901d6466c5e0e4d /src/firecfg
parentMore qtox profile tightening (diff)
downloadfirejail-b936e5ab77dfa0b54b2f6f6dd53762a8244e4230.tar.gz
firejail-b936e5ab77dfa0b54b2f6f6dd53762a8244e4230.tar.zst
firejail-b936e5ab77dfa0b54b2f6f6dd53762a8244e4230.zip
strip trailing whitespace
Diffstat (limited to 'src/firecfg')
-rw-r--r--src/firecfg/desktop_files.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/firecfg/desktop_files.c b/src/firecfg/desktop_files.c
index c1d456147..2edc4c83b 100644
--- a/src/firecfg/desktop_files.c
+++ b/src/firecfg/desktop_files.c
@@ -41,7 +41,7 @@ static int check_profile(const char *name, const char *homedir) {
41 printf("found %s\n", profname2); 41 printf("found %s\n", profname2);
42 rv = 1; 42 rv = 1;
43 } 43 }
44 44
45 free(profname1); 45 free(profname1);
46 free(profname2); 46 free(profname2);
47 return rv; 47 return rv;
@@ -58,11 +58,11 @@ static int have_profile(const char *filename, const char *homedir) {
58 58
59 // we get strange names here, such as .org.gnom.gedit.desktop, com.uploadedlobster.peek.desktop, 59 // we get strange names here, such as .org.gnom.gedit.desktop, com.uploadedlobster.peek.desktop,
60 // or io.github.Pithos.desktop; extract the word before .desktop 60 // or io.github.Pithos.desktop; extract the word before .desktop
61 61
62 char *tmpfname = strdup(filename); 62 char *tmpfname = strdup(filename);
63 if (!tmpfname) 63 if (!tmpfname)
64 errExit("strdup"); 64 errExit("strdup");
65 65
66 // check .desktop extension 66 // check .desktop extension
67 int len = strlen(tmpfname); 67 int len = strlen(tmpfname);
68 if (len <= 8) 68 if (len <= 8)
@@ -70,14 +70,14 @@ static int have_profile(const char *filename, const char *homedir) {
70 if (strcmp(tmpfname + len - 8, ".desktop")) 70 if (strcmp(tmpfname + len - 8, ".desktop"))
71 return 0; 71 return 0;
72 tmpfname[len - 8] = '\0'; 72 tmpfname[len - 8] = '\0';
73 73
74 // extract last word 74 // extract last word
75 char *last_word = strrchr(tmpfname, '.'); 75 char *last_word = strrchr(tmpfname, '.');
76 if (last_word) 76 if (last_word)
77 last_word++; 77 last_word++;
78 else 78 else
79 last_word = tmpfname; 79 last_word = tmpfname;
80 80
81 // try lowercase 81 // try lowercase
82 last_word[0] = tolower(last_word[0]); 82 last_word[0] = tolower(last_word[0]);
83 int rv = check_profile(last_word, homedir); 83 int rv = check_profile(last_word, homedir);
@@ -85,7 +85,7 @@ static int have_profile(const char *filename, const char *homedir) {
85 free(tmpfname); 85 free(tmpfname);
86 return rv; 86 return rv;
87 } 87 }
88 88
89 // try uppercase 89 // try uppercase
90 last_word[0] = toupper(last_word[0]); 90 last_word[0] = toupper(last_word[0]);
91 rv = check_profile(last_word, homedir); 91 rv = check_profile(last_word, homedir);
@@ -228,12 +228,12 @@ void fix_desktop_files(char *homedir) {
228 } 228 }
229 } 229 }
230 } 230 }
231 231
232 if (change_exec == NULL && change_dbus == 0) { 232 if (change_exec == NULL && change_dbus == 0) {
233 munmap(buf, sb.st_size + 1); 233 munmap(buf, sb.st_size + 1);
234 continue; 234 continue;
235 } 235 }
236 236
237 munmap(buf, sb.st_size + 1); 237 munmap(buf, sb.st_size + 1);
238 238
239 //**************************************************** 239 //****************************************************
@@ -247,13 +247,13 @@ void fix_desktop_files(char *homedir) {
247 printf(" %s skipped: file exists\n", filename); 247 printf(" %s skipped: file exists\n", filename);
248 continue; 248 continue;
249 } 249 }
250 250
251 FILE *fpin = fopen(filename, "r"); 251 FILE *fpin = fopen(filename, "r");
252 if (!fpin) { 252 if (!fpin) {
253 fprintf(stderr, "Error: cannot open /usr/share/applications/%s\n", filename); 253 fprintf(stderr, "Error: cannot open /usr/share/applications/%s\n", filename);
254 continue; 254 continue;
255 } 255 }
256 256
257 FILE *fpout = fopen(outname, "w"); 257 FILE *fpout = fopen(outname, "w");
258 if (!fpout) { 258 if (!fpout) {
259 fprintf(stderr, "Error: cannot open ~/.local/share/applications/%s\n", outname); 259 fprintf(stderr, "Error: cannot open ~/.local/share/applications/%s\n", outname);
@@ -277,9 +277,9 @@ void fix_desktop_files(char *homedir) {
277 fprintf(fpout, "Exec=%s\n", change_exec); 277 fprintf(fpout, "Exec=%s\n", change_exec);
278 } 278 }
279 else 279 else
280 fprintf(fpout, "%s", fbuf); 280 fprintf(fpout, "%s", fbuf);
281 } 281 }
282 282
283 if (change_exec) 283 if (change_exec)
284 free(change_exec); 284 free(change_exec);
285 fclose(fpin); 285 fclose(fpin);