Browse Source

Do not overwrite an existing configuration file

If the configuration file already exists, abort with an error
message instead of overwriting it.

We may ask for a confirmation later, but for now, just let the
user delete the file himself before invoking gfsec-split again.
develop
Damien Goutte-Gattat 4 years ago
parent
commit
644d7d972d
  1. 2
      src/gfsec-split.c

2
src/gfsec-split.c

@ -337,6 +337,8 @@ main(int argc, char **argv)
secret_file = argv[optind++];
transform_config_pathname(&config_path, secret_file);
if ( file_exists(config_path) != -1 )
errx(EXIT_FAILURE, "Configuration file %s already exists", config_path);
if ( (c = gfsec_secret_set_secret_file(cfg, secret_file)) != 0 )
errx(EXIT_FAILURE, "Cannot set secret: %s", gfsec_error_string(c));

Loading…
Cancel
Save