37 строки
1.3 KiB
Diff
37 строки
1.3 KiB
Diff
diff -rup chkconfig-1.9/chkconfig.c chkconfig-1.9-new/chkconfig.c
|
|
--- chkconfig-1.9/chkconfig.c 2017-04-07 15:34:37.692467316 -0700
|
|
+++ chkconfig-1.9-new/chkconfig.c 2017-04-07 15:39:56.900460105 -0700
|
|
@@ -878,17 +878,29 @@
|
|
}
|
|
}
|
|
rc = readServiceInfo(name, type, &s, 0);
|
|
- if (rc)
|
|
+ if (rc) {
|
|
+ fprintf(stderr, "%s: unknown service\n", name);
|
|
return 1;
|
|
+ }
|
|
if (s.type == TYPE_XINETD) {
|
|
if (isXinetdEnabled())
|
|
return !s.levels;
|
|
else
|
|
return 1;
|
|
} else {
|
|
- if (level == -1)
|
|
+ if (level == -1) {
|
|
level = currentRunlevel();
|
|
- return s.currentLevels & (1 << level) ? 0 : 1;
|
|
+ if (level == -1) {
|
|
+ fprintf(stderr, "can not detect the current runlevel\n");
|
|
+ return 1;
|
|
+ }
|
|
+ }
|
|
+ if (s.currentLevels & (1 << level)) {
|
|
+ printf("%s on\n", name);
|
|
+ } else {
|
|
+ printf("%s off\n", name);
|
|
+ }
|
|
+ return 0;
|
|
}
|
|
} else if (!strcmp(state, "on")) {
|
|
if (!noRedirectItem) {
|