aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/actions.h1
-rw-r--r--src/add.c13
2 files changed, 11 insertions, 3 deletions
diff --git a/src/actions.h b/src/actions.h
index 60b9645..1b7ef05 100644
--- a/src/actions.h
+++ b/src/actions.h
@@ -27,6 +27,7 @@ CK_ACTIONS
enum AddOptErrors {
ADD_NO_ERR = 0,
ADD_ERR_WRONG_CONFIG,
+ ADD_ERR_LINK_CONFIG,
ADD_ERR_WRONG_FLAGS
};
typedef enum AddOptErrors AddOptErr;
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.");