SOURCES: chkconfig-noxinet.patch - updated
arekm
arekm at pld-linux.org
Thu Apr 24 09:34:33 CEST 2008
Author: arekm Date: Thu Apr 24 07:34:33 2008 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- updated
---- Files affected:
SOURCES:
chkconfig-noxinet.patch (1.5 -> 1.6)
---- Diffs:
================================================================
Index: SOURCES/chkconfig-noxinet.patch
diff -u SOURCES/chkconfig-noxinet.patch:1.5 SOURCES/chkconfig-noxinet.patch:1.6
--- SOURCES/chkconfig-noxinet.patch:1.5 Thu Apr 24 09:20:20 2008
+++ SOURCES/chkconfig-noxinet.patch Thu Apr 24 09:34:28 2008
@@ -1,24 +1,41 @@
-diff -Nru chkconfig-1.2.24h.orig/chkconfig.c chkconfig-1.2.24h/chkconfig.c
---- chkconfig-1.2.24h.orig/chkconfig.c Wed Jul 17 20:10:55 2002
-+++ chkconfig-1.2.24h/chkconfig.c Wed Jan 22 12:43:07 2003
-@@ -70,7 +70,6 @@
+diff -urN chkconfig-1.3.37.org/chkconfig.c chkconfig-1.3.37/chkconfig.c
+--- chkconfig-1.3.37.org/chkconfig.c 2007-11-08 22:28:34.000000000 +0100
++++ chkconfig-1.3.37/chkconfig.c 2008-04-24 09:30:17.709152778 +0200
+@@ -68,8 +68,6 @@
readServiceError(rc, name);
return 1;
}
- if (s.type == TYPE_XINETD) return 0;
+-
- for (level = 0; level <= conf.maxlevel; level++) {
- if (!findServiceEntries(name, level, &globres)) {
-@@ -90,8 +89,6 @@
+ if (!findServiceEntries(name, level, &globres)) {
+ for (i = 0; i < globres.gl_pathc; i++)
+@@ -88,7 +86,6 @@
readServiceError(rc, name);
return 1;
}
+- if (s.type == TYPE_XINETD) return 0;
+
+ for (level = 0; level < 7; level++) {
+ if (!findServiceEntries(name, level, &globres)) {
+@@ -238,7 +235,6 @@
+ return 1;
+ }
+
+- if (s.type == TYPE_XINETD) return 0;
+ if (s.isLSB)
+ frobDependencies(&s);
+ else
+@@ -269,8 +265,6 @@
+ if ((rc = readServiceDifferences(name, &s, &o, 0))) {
+ return 0;
+ }
-
- if (s.type == TYPE_XINETD) return 0;
-
- for (i = 0; i <= conf.maxlevel; i++) {
- if (!isConfigured(name, i)) {
-@@ -118,10 +115,6 @@
+
+ if ((s.levels == o.levels) &&
+ (s.kPriority == o.kPriority) &&
+@@ -351,10 +345,6 @@
}
printf("%-15s", s.name);
@@ -27,44 +44,61 @@
- return 0;
- }
- for (i = 0; i <= conf.maxlevel; i++) {
+ for (i = 0; i < 7; i++) {
printf("\t%d:%s", i, isOn(s.name, i) ? _("on") : _("off"));
-@@ -131,21 +124,6 @@
+@@ -364,32 +354,10 @@
return 0;
}
-static int isXinetdEnabled() {
-- int i;
-- struct service s;
+- int i;
+- struct service s;
+-
+- if (readServiceInfo("xinetd", &s, 0)) {
+- return 0;
+- }
+- for (i = 0; i < 7; i++) {
+- if (isOn("xinetd", i))
+- return 1;
+- }
+- return 0;
+-}
-
-- if (readServiceInfo("xinetd", &s, 0)) {
-- return 0;
-- }
-- for (i = 0; i <= conf.maxlevel; i++) {
-- if (isOn("xinetd", i))
-- return 1;
-- }
-- return 0;
+ static int serviceNameCmp(const void * a, const void * b) {
+ return strcmp(* (char **)a, * (char **)b);
+ }
+
+-static int xinetdNameCmp(const void * a, const void * b) {
+- const struct service * first = a;
+- const struct service * second = b;
+-
+- return strcmp(first->name, second->name);
-}
--
-
+-
+
static int listService(char * item) {
DIR * dir;
- struct dirent * ent;
-@@ -200,34 +178,6 @@
-
+@@ -459,53 +427,6 @@
+
closedir(dir);
-
+
- if (isXinetdEnabled()) {
+- struct service *s, *t;
+-
+- printf("\n");
- printf(_("xinetd based services:\n"));
-- if (!(dir = opendir(conf.xinetddir))) {
-- fprintf(stderr, _("failed to open directory %s: %s"),
-- conf.xinetddir, strerror(err));
+- if (!(dir = opendir(XINETDDIR))) {
+- fprintf(stderr, _("failed to open directory %s: %s\n"),
+- XINETDDIR, strerror(err));
- return 1;
- }
+- numServices = 0;
+- numServicesAlloced = 10;
+- s = malloc(sizeof (*s) * numServicesAlloced);
+-
- while ((ent = readdir(dir))) {
- const char *dn;
-- struct service s;
-
- /* Skip any file starting with a . */
- if (ent->d_name[0] == '.') continue;
@@ -78,48 +112,77 @@
- if (*dn == '~' || *dn == ',')
- continue;
-
-- readXinetdServiceInfo(ent->d_name, &s, 0);
-- printf("\t%s:\t%s\n", s.name, s.levels ? _("on") : _("off"));
+- if (numServices == numServicesAlloced) {
+- numServicesAlloced += 10;
+- s = realloc(s, numServicesAlloced * sizeof (*s));
+- }
+- if (readXinetdServiceInfo(ent->d_name, s + numServices, 0) != -1)
+- numServices ++;
+- }
+-
+- qsort(s, numServices, sizeof(*s), xinetdNameCmp);
+- t = s;
+- for (i = 0; i < numServices; i++, s++) {
+- char *tmp = malloc(strlen(s->name) + 5);
+- sprintf(tmp,"%s:",s->name);
+- printf("\t%-15s\t%s\n", tmp, s->levels ? _("on") : _("off"));
- }
- closedir(dir);
+- free(t);
- }
return 0;
}
-@@ -249,7 +199,6 @@
- return 1;
- }
-
-- if (s.type == TYPE_INIT_D) {
- for (i = 0; i <= conf.maxlevel; i++) {
- if (!((1 << i) & where)) continue;
-
-@@ -261,14 +210,6 @@
- what = 0;
- doSetService(s, i, what);
+@@ -547,11 +468,6 @@
+ rc |= doSetService(s, i, what);
}
+ return rc;
- } else if (s.type == TYPE_XINETD) {
-- char xinetd[250];
--
-- setXinetdService(s, state);
-- snprintf(xinetd, sizeof(xinetd),
-- "%s/xinetd reload >/dev/null 2>&1", conf.initdir);
-- system(xinetd);
-- }
+- if (setXinetdService(s, state)) {
+- return 1;
+- }
+- system("/etc/init.d/xinetd reload >/dev/null 2>&1");
+ }
return 0;
- }
-diff -Nru chkconfig-1.2.24h.orig/leveldb.c chkconfig-1.2.24h/leveldb.c
---- chkconfig-1.2.24h.orig/leveldb.c Fri Apr 19 03:15:55 2002
-+++ chkconfig-1.2.24h/leveldb.c Wed Jan 22 12:46:28 2003
-@@ -140,88 +140,6 @@
+@@ -682,13 +598,7 @@
+ rc = readServiceInfo(name, &s, 0);
+ if (rc)
+ return 1;
+- if (s.type == TYPE_XINETD) {
+- if (isOn("xinetd",level))
+- return !s.levels;
+- else
+- return 1;
+- } else
+- return isOn(name, level) ? 0 : 1;
++ return isOn(name, level) ? 0 : 1;
+ } else if (!strcmp(state, "on"))
+ return setService(name, where, 1);
+ else if (!strcmp(state, "off"))
+diff -urN chkconfig-1.3.37.org/leveldb.c chkconfig-1.3.37/leveldb.c
+--- chkconfig-1.3.37.org/leveldb.c 2007-08-03 19:57:56.000000000 +0200
++++ chkconfig-1.3.37/leveldb.c 2008-04-24 09:30:40.913595417 +0200
+@@ -149,101 +149,6 @@
return 0;
}
-int readXinetdServiceInfo(char *name, struct service * service, int honorHide) {
- char * filename = alloca(strlen(name) + strlen(XINETDDIR) + 50);
- int fd;
-- struct service serv = { NULL, -1, -1, -1, NULL, 1, -1 };
+- struct service serv = {
+- name: NULL,
+- levels: -1,
+- kPriority: -1,
+- sPriority: -1,
+- desc: NULL,
+- startDeps: NULL,
+- stopDeps: NULL,
+- provides: NULL,
+- type: TYPE_XINETD,
+- isLSB: 0,
+- enabled: -1
+- };
- struct stat sb;
- char * buf, *ptr;
- char * eng_desc = NULL, *start;
@@ -128,6 +191,7 @@
-
- if ((fd = open(filename, O_RDONLY)) < 0) return -1;
- fstat(fd,&sb);
+- if (! S_ISREG(sb.st_mode)) return -1;
- buf = malloc(sb.st_size+1);
- if (read(fd,buf,sb.st_size)!=sb.st_size) {
- close(fd);
@@ -199,18 +263,9 @@
-}
-
int readServiceInfo(char * name, struct service * service, int honorHide) {
- char * filename = alloca(strlen(name) + strlen(conf.initdir) + 50);
+ char * filename = alloca(strlen(name) + strlen(RUNLEVELS) + 50);
int fd;
-@@ -235,7 +153,7 @@
- sprintf(filename, "%s/%s", conf.initdir, name);
-
- if ((fd = open(filename, O_RDONLY)) < 0) {
-- return readXinetdServiceInfo(name,service,honorHide);
-+ return -1;
- }
- fstat(fd, &sb);
-
-@@ -427,60 +345,6 @@
+@@ -656,60 +561,6 @@
return 1;
}
@@ -271,90 +326,3 @@
int doSetService(struct service s, int level, int on) {
int priority = on ? s.sPriority : s.kPriority;
char linkname[200];
-diff -Nru chkconfig-1.2.24h.orig/ntsysv.c chkconfig-1.2.24h/ntsysv.c
---- chkconfig-1.2.24h.orig/ntsysv.c Sun Jul 28 10:50:04 2002
-+++ chkconfig-1.2.24h/ntsysv.c Wed Jan 22 12:50:38 2003
-@@ -64,11 +64,6 @@
- states = alloca(sizeof(*states) * numServices);
-
- for (i = 0; i < numServices; i++) {
-- if (services[i].type == TYPE_XINETD) {
-- checkboxes[i] = newtCheckbox(-1, i, services[i].name,
-- services[i].levels ? '*' : ' ', NULL,
-- states + i);
-- } else {
- for (j = 0; j <= conf.maxlevel; j++) {
- if (levels & (1 << j)) {
- if (isOn(services[i].name, j)) break;
-@@ -78,7 +73,6 @@
- (j != (conf.maxlevel+1)) ?
- '*' : ' ', NULL,
- states + i);
-- }
- newtFormAddComponent(subform, checkboxes[i]);
- }
-
-@@ -135,13 +129,9 @@
- if (!update) return 1;
-
- for (i = 0; i < numServices; i++) {
-- if (services[i].type == TYPE_XINETD)
-- setXinetdService(services[i], states[i] == '*');
-- else {
- for (j = 0; j <= conf.maxlevel; j++) {
- if (levels & (1 << j))
- doSetService(services[i], j, states[i] == '*');
-- }
- }
- }
-
-@@ -212,49 +202,6 @@
-
- closedir(dir);
-
-- if (!stat("/usr/sbin/xinetd",&sb)) {
-- if (!(dir = opendir(conf.xinetddir))) {
-- fprintf(stderr, "failed to open %s: %s\n", conf.xinetddir,
-- strerror(errno));
-- return 2;
-- }
--
-- while ((ent = readdir(dir))) {
-- if (strchr(ent->d_name, '~') || strchr(ent->d_name, ',') ||
-- strchr(ent->d_name, '.')) continue;
--
-- sprintf(fn, "%s/%s", conf.xinetddir, ent->d_name);
-- if (stat(fn, &sb))
-- {
-- err = errno;
-- continue;
-- }
-- if (!S_ISREG(sb.st_mode)) continue;
--
-- if (numServices == numServicesAlloced) {
-- numServicesAlloced += 10;
-- services = realloc(services,
-- numServicesAlloced * sizeof(*services));
-- }
--
-- rc = readXinetdServiceInfo(ent->d_name, services + numServices, honorHide);
--
-- if (rc == -1) {
-- fprintf(stderr, _("error reading info for service %s: %s\n"),
-- ent->d_name, strerror(errno));
-- closedir(dir);
-- return 2;
-- } else if (!rc)
-- numServices++;
-- }
--
-- if (err) {
-- fprintf(stderr, _("error reading from directory %s: %s\n"),
-- conf.xinetddir, strerror(err));
-- return 1;
-- }
-- }
--
- qsort(services, numServices, sizeof(*services), serviceNameCmp);
-
- *servicesPtr = services;
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/chkconfig-noxinet.patch?r1=1.5&r2=1.6&f=u
More information about the pld-cvs-commit
mailing list