mirror of
https://github.com/troglobit/finit.git
synced 2026-10-15 10:29:35 +00:00
initctl: let -n ignore errors from enable/disable as well
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
7703d00e82
commit
8f1d1717f8
3 files changed
+5
-4
No files matched your search
+1
-1
@@ -1267,7 +1267,7 @@ static int usage(int rc)
|
||||
" -f, --force Ignore missing files and arguments, never prompt\n"
|
||||
" -h, --help This help text\n"
|
||||
" -j, --json JSON output in 'status' and 'cond' commands\n"
|
||||
" -n, --noerr Ignore error for non-existent services\n"
|
||||
" -n, --noerr Ignore error, e.g., already started/enabled/...\n"
|
||||
" -1, --once Only one lap in commands like 'top'\n"
|
||||
" -p, --plain Use plain table headings, no ctrl chars\n"
|
||||
" -q, --quiet Silent, only return status of command\n"
|
||||
|
||||
@@ -37,6 +37,7 @@ extern int iforce; /* initctl -f */
|
||||
extern int ionce; /* initctl -1 */
|
||||
extern int heading; /* initctl -t */
|
||||
extern int json; /* initctl -j */
|
||||
extern int noerr; /* initctl -n */
|
||||
extern int verbose; /* initctl -v */
|
||||
extern int plain; /* initctl -p */
|
||||
extern int quiet; /* initctl -q */
|
||||
|
||||
+3
-3
@@ -282,7 +282,7 @@ int serv_enable(char *arg)
|
||||
|
||||
snprintf(argpath, sizeof(argpath), "%s/enabled/%s", finit_rcsd, arg);
|
||||
if (fexist(argpath))
|
||||
ERRX(1, "%s already enabled", arg);
|
||||
ERRX(noerr ? 0 : 1, "%s already enabled", arg);
|
||||
|
||||
return symlink(path, argpath) != 0;
|
||||
}
|
||||
@@ -308,10 +308,10 @@ int do_disable(char *arg, int check)
|
||||
dbg("Failed changing to %s/enabled/: %s", finit_rcsd, strerror(errno));
|
||||
|
||||
if (check && stat(arg, &st))
|
||||
ERRX(6, "%s not (an) enabled (service).", arg);
|
||||
ERRX(noerr ? 0 : 6, "%s not (an) enabled (service).", arg);
|
||||
|
||||
if (check && (st.st_mode & S_IFMT) == S_IFLNK)
|
||||
ERRX(1, "cannot disable %s, not a symlink.", arg);
|
||||
ERRX(noerr ? 0 : 1, "cannot disable %s, not a symlink.", arg);
|
||||
|
||||
return remove(arg) != 0;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user