Browse Source

Exit with an error on any problem.

Do not report success if anything fails *after* the secret file
has been split or reconstructed.
master
Damien Goutte-Gattat 4 years ago
parent
commit
f43d6e92c8
  1. 3
      src/gfsec-split.c
  2. 8
      src/gfsec-use.c

3
src/gfsec-split.c

@ -376,7 +376,8 @@ main(int argc, char **argv)
gfsec_secret_free(cfg);
if ( ! keep_original )
unlink(secret_file);
if ( unlink(secret_file) == -1 )
err(EXIT_FAILURE, _("Cannot delete original file"));
return EXIT_SUCCESS;
}

8
src/gfsec-use.c

@ -277,11 +277,15 @@ main(int argc, char **argv)
int status;
if ( waitpid(pid, &status, 0) == -1 )
warn(_("Cannot wait for child process"));
err(EXIT_FAILURE, _("Cannot wait for child process"));
if ( ! WIFEXITED(status) )
err(EXIT_FAILURE, _("Child process terminated anormally"));
printf(_("Removing secret.\n"));
unlink(output_file);
if ( unlink(output_file) == -1 )
err(EXIT_FAILURE, _("Cannot delete reconstructed file"));
}
gfsec_secret_free(cfg);

Loading…
Cancel
Save