X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=uxc.c;h=c15b4bc42cbeb93b0262edc741b4d025fcf1a197;hb=79f8cfa58ee7ec828a0fe3519ce696be42a81b2d;hp=230e19bf6032ac5a2d90216d25b6ec7ee3c930f7;hpb=a839518dcd9804050309ef0221c0587772d49f36;p=project%2Fprocd.git diff --git a/uxc.c b/uxc.c index 230e19b..c15b4bc 100644 --- a/uxc.c +++ b/uxc.c @@ -1032,9 +1032,12 @@ static int uxc_set(char *name, char *path, signed char autostart, char *pidfile, char *t1, *t2; t1 = strdup(cfname); t2 = strrchr(t1, '/'); + if (!t2) + return -EINVAL; + *t2 = '\0'; - if (asprintf(&t2, "%s/settings", t1, name) == -1) + if (asprintf(&t2, "%s/settings", t1) == -1) return -ENOMEM; ret = mkdir(t2, 0755);