diff options
| author | Tristan Riehs <tristan.riehs@inria.fr> | 2025-12-29 16:23:14 +0100 |
|---|---|---|
| committer | Tristan Riehs <tristan.riehs@inria.fr> | 2025-12-29 16:23:14 +0100 |
| commit | 0901e361de801b84c0e647d4188d6af7f4082b9c (patch) | |
| tree | 999375032ab5851e8089213d7f1ad580410fdedd /src/main.c | |
| parent | fbb3fb48e43507a6a5d5a4638b7df5661b1804ad (diff) | |
Make sure to clean up temporary directory
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -308,6 +308,7 @@ static void ftag_export(int argc, char **argv) free(line); /* step 3: invoke tar to build the archive */ + int error = 0; rc = fork(); if (rc == 0) { execlp("tar", @@ -327,16 +328,18 @@ static void ftag_export(int argc, char **argv) wait(&status); if (!(WIFEXITED(status) && WEXITSTATUS(status) == 0)) { fprintf(stderr, "ftag export: child process exited abnormally\n"); - exit(EXIT_FAILURE); + error = 1; } } else { perror("fork"); - exit(EXIT_FAILURE); + error = 1; } /* step 4: clean /tmp */ execlp("rm", "rm", "--recursive", "--force", tmp_dir, NULL); + if (error) + exit(EXIT_FAILURE); } /* Create ftag's database and directories. */ |
