]>
Commit | Line | Data |
---|---|---|
12254151 ER |
1 | --- chkconfig-1.3.58/chkconfig.c~ 2012-12-04 15:41:14.000000000 +0200 |
2 | +++ chkconfig-1.3.58/chkconfig.c 2012-12-04 15:42:06.080488828 +0200 | |
09a63b21 | 3 | @@ -27,6 +27,7 @@ |
82df657c | 4 | #include <unistd.h> |
09a63b21 | 5 | |
82df657c ER |
6 | static char *progname; |
7 | +extern int addItem; | |
82df657c ER |
8 | |
9 | #define _(String) gettext((String)) | |
09a63b21 AM |
10 | |
11 | @@ -243,12 +244,10 @@ | |
12 | frobDependencies(&s); | |
13 | else | |
14 | for (i = 0; i < 7; i++) { | |
15 | - if (!isConfigured(name, i, NULL, NULL)) { | |
82df657c ER |
16 | if ((1 << i) & s.levels) |
17 | doSetService(s, i, 1); | |
18 | else | |
19 | doSetService(s, i, 0); | |
20 | - } | |
21 | } | |
22 | ||
23 | return 0; | |
12254151 | 24 | @@ -626,7 +626,7 @@ |
09a63b21 | 25 | } |
82df657c | 26 | |
12254151 ER |
27 | int main(int argc, const char ** argv) { |
28 | - int listItem = 0, addItem = 0, delItem = 0, overrideItem = 0, noRedirectItem = 0; | |
29 | + int listItem = 0, delItem = 0, overrideItem = 0, noRedirectItem = 0; | |
30 | int type = TYPE_ANY; | |
82df657c ER |
31 | int rc, i, x; |
32 | char * levels = NULL; | |
5edaa756 ER |
33 | --- chkconfig-1.4/leveldb.c~ 2015-04-25 12:18:41.000000000 +0300 |
34 | +++ chkconfig-1.4/leveldb.c 2015-04-25 12:19:52.959858162 +0300 | |
35 | @@ -22,6 +22,7 @@ | |
36 | #include <libintl.h> | |
37 | #include <locale.h> | |
38 | #include <sys/mman.h> | |
82df657c | 39 | +#include <sys/types.h> |
5edaa756 ER |
40 | #include <sys/stat.h> |
41 | #include <stdlib.h> | |
42 | #include <stdio.h> | |
43 | @@ -41,6 +42,8 @@ | |
44 | ||
45 | #include "leveldb.h" | |
82df657c | 46 | |
5edaa756 ER |
47 | +int addItem = 0; |
48 | + | |
49 | int selinux_restore(const char *name) { | |
50 | struct selabel_handle *hnd = NULL; | |
51 | struct stat buf; | |
09a63b21 AM |
52 | @@ -563,6 +567,25 @@ |
53 | serv.provides[1] = NULL; | |
54 | } | |
82df657c ER |
55 | |
56 | + if (addItem) { | |
09a63b21 AM |
57 | + DIR *dir; |
58 | + struct dirent *dirent; | |
59 | + int i; | |
60 | + | |
61 | + strcpy(levelbuf,"/etc/rc.d/rc0.d"); | |
62 | + for(i=0;i<7;i++,levelbuf[12]++) { | |
63 | + dir=opendir(levelbuf); | |
64 | + if (!dir) return 1; | |
65 | + while ((dirent=readdir(dir))) { | |
66 | + if (strlen(dirent->d_name)<4) continue; | |
67 | + if (strcmp(dirent->d_name+3,name)) continue; | |
68 | + if (*dirent->d_name=='K') serv.levels &= ~(1<<i); | |
69 | + else if (*dirent->d_name=='S') serv.levels |= 1<<i; | |
70 | + } | |
71 | + closedir(dir); | |
82df657c | 72 | + } |
82df657c ER |
73 | + } |
74 | + | |
75 | *service = serv; | |
76 | return 0; | |
77 | } |