diff options
Diffstat (limited to 'src/firecfg/desktop_files.c')
-rw-r--r-- | src/firecfg/desktop_files.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/firecfg/desktop_files.c b/src/firecfg/desktop_files.c index 71b39390e..f09a23977 100644 --- a/src/firecfg/desktop_files.c +++ b/src/firecfg/desktop_files.c | |||
@@ -144,6 +144,8 @@ void fix_desktop_files(char *homedir) { | |||
144 | perror("opendir"); | 144 | perror("opendir"); |
145 | fprintf(stderr, "Warning: cannot access /usr/share/applications directory, desktop files fixing skipped...\n"); | 145 | fprintf(stderr, "Warning: cannot access /usr/share/applications directory, desktop files fixing skipped...\n"); |
146 | free(user_apps_dir); | 146 | free(user_apps_dir); |
147 | if (dir) | ||
148 | closedir(dir); | ||
147 | return; | 149 | return; |
148 | } | 150 | } |
149 | 151 | ||
@@ -182,7 +184,9 @@ void fix_desktop_files(char *homedir) { | |||
182 | } | 184 | } |
183 | 185 | ||
184 | fseek(fp, 0, SEEK_END); | 186 | fseek(fp, 0, SEEK_END); |
185 | size_t size = ftell(fp); | 187 | long size = ftell(fp); |
188 | if (size == -1) | ||
189 | errExit("ftell"); | ||
186 | fseek(fp, 0, SEEK_SET); | 190 | fseek(fp, 0, SEEK_SET); |
187 | char *buf = malloc(size + 1); | 191 | char *buf = malloc(size + 1); |
188 | if (!buf) | 192 | if (!buf) |
@@ -266,12 +270,16 @@ void fix_desktop_files(char *homedir) { | |||
266 | 270 | ||
267 | if (stat(outname, &sb) == 0) { | 271 | if (stat(outname, &sb) == 0) { |
268 | printf(" %s skipped: file exists\n", filename); | 272 | printf(" %s skipped: file exists\n", filename); |
273 | if (change_exec) | ||
274 | free(change_exec); | ||
269 | continue; | 275 | continue; |
270 | } | 276 | } |
271 | 277 | ||
272 | FILE *fpin = fopen(filename, "r"); | 278 | FILE *fpin = fopen(filename, "r"); |
273 | if (!fpin) { | 279 | if (!fpin) { |
274 | fprintf(stderr, "Warning: cannot open /usr/share/applications/%s\n", filename); | 280 | fprintf(stderr, "Warning: cannot open /usr/share/applications/%s\n", filename); |
281 | if (change_exec) | ||
282 | free(change_exec); | ||
275 | continue; | 283 | continue; |
276 | } | 284 | } |
277 | 285 | ||
@@ -279,6 +287,8 @@ void fix_desktop_files(char *homedir) { | |||
279 | if (!fpout) { | 287 | if (!fpout) { |
280 | fprintf(stderr, "Warning: cannot open ~/.local/share/applications/%s\n", outname); | 288 | fprintf(stderr, "Warning: cannot open ~/.local/share/applications/%s\n", outname); |
281 | fclose(fpin); | 289 | fclose(fpin); |
290 | if (change_exec) | ||
291 | free(change_exec); | ||
282 | continue; | 292 | continue; |
283 | } | 293 | } |
284 | fprintf(fpout, "# converted by firecfg\n"); | 294 | fprintf(fpout, "# converted by firecfg\n"); |