diff options
author | gramanas <anastasis.gramm2@gmail.com> | 2018-11-19 01:54:32 +0200 |
---|---|---|
committer | gramanas <anastasis.gramm2@gmail.com> | 2018-11-19 01:54:32 +0200 |
commit | 84bbbb91c9154ca0b1c295eb7d1aa0de59450764 (patch) | |
tree | 781dc2760b6898e567058ce04779cb67a174ea72 /src/add.c | |
parent | a6290ec9d98e3b7cc650db134b17ee6d6a64f46d (diff) | |
download | ck-84bbbb91c9154ca0b1c295eb7d1aa0de59450764.tar.gz ck-84bbbb91c9154ca0b1c295eb7d1aa0de59450764.tar.bz2 ck-84bbbb91c9154ca0b1c295eb7d1aa0de59450764.zip |
Better error report on add
Diffstat (limited to 'src/add.c')
-rw-r--r-- | src/add.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -241,11 +241,15 @@ static AddOpt add_make_options(cklist *args) { }; list_next(args); - if (!util_is_file_rw(list_get(args)) - || !util_is_file_link(list_get(args))) { + strcpy(addOpt.confPath, list_get(args)); + if (!util_is_file_rw(addOpt.confPath)) { addOpt.err = ADD_ERR_WRONG_CONFIG; return addOpt; } + if (!util_is_file_link(addOpt.confPath)) { + addOpt.err = ADD_ERR_LINK_CONFIG; + return addOpt; + } realpath(list_get(args), addOpt.confPath); while (list_next(args)) { @@ -304,8 +308,11 @@ int run_ADD(UserOpt * opt, Conf *conf) { switch (addOpt.err) { case ADD_NO_ERR: break; + case ADD_ERR_LINK_CONFIG: + ERR("%s is a link.", addOpt.confPath); + goto error; case ADD_ERR_WRONG_CONFIG: - ERR("The config file specified doesn't exist or is a link."); + ERR("%s doesn't exist.", addOpt.confPath); goto error; case ADD_ERR_WRONG_FLAGS: ERR("Flags are: -s for secret and -p for primary."); |