aboutsummaryrefslogtreecommitdiffstats
path: root/src/add.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/add.c')
-rw-r--r--src/add.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/add.c b/src/add.c
index 9959204..574ac73 100644
--- a/src/add.c
+++ b/src/add.c
@@ -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.");