]> git.pld-linux.org Git - packages/chkconfig.git/blobdiff - chkconfig-noxinet.patch
- updated
[packages/chkconfig.git] / chkconfig-noxinet.patch
index c64a6ec345f32441de9d6d0492acbf80d342c074..def510e6d17618471705cca7bd1d0df4e59f84aa 100644 (file)
@@ -1,24 +1,24 @@
-diff -Nur chkconfig-1.2.16.orig/chkconfig.c chkconfig-1.2.16/chkconfig.c
---- chkconfig-1.2.16.orig/chkconfig.c  Sat Mar 24 14:51:20 2001
-+++ chkconfig-1.2.16/chkconfig.c       Sat Mar 24 15:15:33 2001
-@@ -52,7 +52,6 @@
+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 @@
        readServiceError(rc, name);
        return 1;
      }
 -    if (s.type == TYPE_XINETD) return 0;
  
-     for (level = 0; level < 7; level++) {
+     for (level = 0; level <= conf.maxlevel; level++) {
            if (!findServiceEntries(name, level, &globres)) {
-@@ -73,8 +72,6 @@
+@@ -90,8 +89,6 @@
+       readServiceError(rc, name);
        return 1;
      }
-       
+-      
 -    if (s.type == TYPE_XINETD) return 0;
--    
-     for (i = 0; i < 7; i++) {
-           if ((1 << i) & s.levels)
-               doSetService(s, i, 1);
-@@ -97,10 +94,6 @@
+     
+     for (i = 0; i <= conf.maxlevel; i++) {
+       if (!isConfigured(name, i)) {
+@@ -118,10 +115,6 @@
      }
  
      printf("%-15s", s.name);
@@ -27,39 +27,39 @@ diff -Nur chkconfig-1.2.16.orig/chkconfig.c chkconfig-1.2.16/chkconfig.c
 -          return 0;
 -    }
  
-     for (i = 0; i < 7; i++) {
+     for (i = 0; i <= conf.maxlevel; i++) {
        printf("\t%d:%s", i, isOn(s.name, i) ? _("on") : _("off"));
-@@ -110,21 +103,6 @@
+@@ -131,21 +124,6 @@
      return 0;
  }
  
 -static int isXinetdEnabled() {
--      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;
+-    int i;
+-    struct service s;
+-
+-    if (readServiceInfo("xinetd", &s, 0)) {
+-          return 0;
+-    }
+-    for (i = 0; i <= conf.maxlevel; i++) {
+-      if (isOn("xinetd", i))
+-            return 1;
+-    }
+-    return 0;
 -}
 -      
 -
  static int listService(char * item) {
      DIR * dir;
      struct dirent * ent;
-@@ -176,34 +154,6 @@
+@@ -200,34 +178,6 @@
  
      closedir(dir);
-       
 -    if (isXinetdEnabled()) {
 -          printf(_("xinetd based services:\n"));
--          if (!(dir = opendir(XINETDDIR))) {
+-          if (!(dir = opendir(conf.xinetddir))) {
 -                  fprintf(stderr, _("failed to open directory %s: %s"),
--                          XINETDDIR, strerror(err));
+-                          conf.xinetddir, strerror(err));
 -                  return 1;
 -          }
 -          while ((ent = readdir(dir))) {
@@ -71,7 +71,7 @@ diff -Nur chkconfig-1.2.16.orig/chkconfig.c chkconfig-1.2.16/chkconfig.c
 -
 -                  /* Skip files with known bad extensions */
 -                  if ((dn = strrchr(ent->d_name, '.')) != NULL &&
--                      (!strcmp(dn, ".rpmsave") || !strcmp(dn, ".rpmorig") || !strcmp(dn, ".swp")))
+-                      (!strcmp(dn, ".rpmsave") || !strcmp(dn, ".rpmnew") || !strcmp(dn, ".rpmorig") || !strcmp(dn, ".swp")))
 -                    continue;
 -
 -                  dn = ent->d_name + strlen(ent->d_name) - 1;
@@ -86,42 +86,33 @@ diff -Nur chkconfig-1.2.16.orig/chkconfig.c chkconfig-1.2.16/chkconfig.c
      return 0;
  }
  
-@@ -225,21 +175,16 @@
+@@ -249,7 +199,6 @@
        return 1;
      }
  
 -    if (s.type == TYPE_INIT_D) {
--          for (i = 0; i < 7; i++) {
--                  if (!((1 << i) & where)) continue;
--
--                  if (state == 1 || state == 0)
--                    what = state;
--                  else if (s.levels & (1 << i))
--                    what = 1;
--                  else
--                    what = 0;
--                  doSetService(s, i, what);
--          }
+           for (i = 0; i <= conf.maxlevel; i++) {
+                   if (!((1 << i) & where)) continue;
+@@ -261,14 +210,6 @@
+                     what = 0;
+                   doSetService(s, i, what);
+           }
 -    } else if (s.type == TYPE_XINETD) {
+-          char xinetd[250];
+-
 -          setXinetdService(s, state);
--          system("/etc/init.d/xinetd reload >/dev/null 2>&1");
-+    for (i = 0; i < 7; i++) {
-+          if (!((1 << i) & where)) continue;
-+
-+          if (state == 1 || state == 0)
-+            what = state;
-+          else if (s.levels & (1 << i))
-+            what = 1;
-+          else
-+            what = 0;
-+          doSetService(s, i, what);
-     }
+-          snprintf(xinetd, sizeof(xinetd),
+-                      "%s/xinetd reload >/dev/null 2>&1", conf.initdir);
+-          system(xinetd);
+-    }
  
      return 0;
-diff -Nur chkconfig-1.2.16.orig/leveldb.c chkconfig-1.2.16/leveldb.c
---- chkconfig-1.2.16.orig/leveldb.c    Sat Mar 24 14:51:20 2001
-+++ chkconfig-1.2.16/leveldb.c Sat Mar 24 15:17:14 2001
-@@ -138,88 +138,6 @@
+ }
+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 @@
        return 0;
  }
  
@@ -208,10 +199,10 @@ diff -Nur chkconfig-1.2.16.orig/leveldb.c chkconfig-1.2.16/leveldb.c
 -}
 -
  int readServiceInfo(char * name, struct service * service, int honorHide) {
-     char * filename = alloca(strlen(name) + strlen(RUNLEVELS) + 50);
+     char * filename = alloca(strlen(name) + strlen(conf.initdir) + 50);
      int fd;
-@@ -236,7 +154,7 @@
-     sprintf(filename, RUNLEVELS "/init.d/%s", name);
+@@ -235,7 +153,7 @@
+     sprintf(filename, "%s/%s", conf.initdir, name);
  
      if ((fd = open(filename, O_RDONLY)) < 0) {
 -          return readXinetdServiceInfo(name,service,honorHide);
@@ -219,12 +210,10 @@ diff -Nur chkconfig-1.2.16.orig/leveldb.c chkconfig-1.2.16/leveldb.c
      }
      fstat(fd, &sb);
  
-@@ -418,60 +336,6 @@
-     globfree(&globres);
+@@ -427,60 +345,6 @@
      return 1;
--}
--
+ }
 -int setXinetdService(struct service s, int on) {
 -      int oldfd, newfd;
 -      char oldfname[100], newfname[100];
@@ -262,7 +251,7 @@ diff -Nur chkconfig-1.2.16.orig/leveldb.c chkconfig-1.2.16/leveldb.c
 -                      ptr++;
 -              } 
 -              while (isspace(*buf)) buf++;
--              if (strncmp(buf,"disable", 7)) {
+-              if (strncmp(buf,"disable", 7) && strlen(buf)) {
 -                      write(newfd,tmp,strlen(tmp));
 -                      write(newfd,"\n",1);
 -                      if (buf[0] == '{') {
@@ -277,37 +266,15 @@ diff -Nur chkconfig-1.2.16.orig/leveldb.c chkconfig-1.2.16/leveldb.c
 -      chmod(newfname,0644);
 -      unlink(oldfname);
 -      return(rename(newfname,oldfname));
- }
+-}
+-
  int doSetService(struct service s, int level, int on) {
-diff -Nur chkconfig-1.2.16.orig/leveldb.h chkconfig-1.2.16/leveldb.h
---- chkconfig-1.2.16.orig/leveldb.h    Sat Mar 24 14:51:20 2001
-+++ chkconfig-1.2.16/leveldb.h Sat Mar 24 15:14:46 2001
-@@ -2,12 +2,10 @@
- #define H_LEVELDB
- #define RUNLEVELS "/etc/rc.d"
--#define XINETDDIR "/etc/xinetd.d"
- #include <glob.h>
- #define TYPE_INIT_D   0
--#define TYPE_XINETD   1
- struct service {
-     char * name;
-@@ -27,7 +25,5 @@
- int isConfigured(char * name, int level);
- int doSetService(struct service s, int level, int on);
- int findServiceEntries(char * name, int level, glob_t * globresptr);
--int readXinetdServiceInfo(char *name, struct service *service, int honorHide);
--int setXinetdService(struct service s, int on);
- #endif
-diff -Nur chkconfig-1.2.16.orig/ntsysv.c chkconfig-1.2.16/ntsysv.c
---- chkconfig-1.2.16.orig/ntsysv.c     Wed Aug 16 22:04:28 2000
-+++ chkconfig-1.2.16/ntsysv.c  Sat Mar 24 15:14:46 2001
-@@ -40,20 +40,14 @@
+     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++) {
@@ -316,86 +283,78 @@ diff -Nur chkconfig-1.2.16.orig/ntsysv.c chkconfig-1.2.16/ntsysv.c
 -                                   services[i].levels ? '*' : ' ', NULL, 
 -                                   states + i);
 -      } else {
--              for (j = 0; j < 7; j++) {
--                      if (levels & (1 << j)) {
--                              if (isOn(services[i].name, j)) break;
--                      }
-+      for (j = 0; j < 7; j++) {
-+              if (levels & (1 << j)) {
-+                      if (isOn(services[i].name, j)) break;
-               }
--              checkboxes[i] = newtCheckbox(-1, i, services[i].name, 
--                                           (j != 7) ? '*' : ' ', NULL, 
--                                           states + i);
-       }
-+      checkboxes[i] = newtCheckbox(-1, i, services[i].name, 
-+                                   (j != 7) ? '*' : ' ', NULL, 
-+                                   states + i);
+               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]);
      }
  
-@@ -110,13 +104,9 @@
+@@ -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 < 7; j++) {
--                    if (levels & (1 << j))
--                      doSetService(services[i], j, states[i] == '*');
+             for (j = 0; j <= conf.maxlevel; j++) {
+                     if (levels & (1 << j))
+                       doSetService(services[i], j, states[i] == '*');
 -            }
-+      for (j = 0; j < 7; j++) {
-+            if (levels & (1 << j))
-+              doSetService(services[i], j, states[i] == '*');
        }
      }
  
-@@ -186,47 +176,6 @@
-     }
+@@ -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;
+-      }
 -
--    if (!(dir = opendir(XINETDDIR))) {
--      fprintf(stderr, "failed to open " XINETDDIR ": %s\n",
--              strerror(errno));
--        return 2;
--    }
+-      while ((ent = readdir(dir))) {
+-          if (strchr(ent->d_name, '~') || strchr(ent->d_name, ',') ||
+-              strchr(ent->d_name, '.')) continue;
 -
--    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;
 -
--      sprintf(fn, "%s/%s", 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));
+-          }
 -
--      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++;
 -      }
 -
--      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;
+-      }
 -    }
 -
--    if (err) {
--      fprintf(stderr, _("error reading from directory %s: %s\n"),
--              XINETDDIR, strerror(err));
--        return 1;
--    }
      qsort(services, numServices, sizeof(*services), serviceNameCmp);
  
+     *servicesPtr = services;
This page took 0.084639 seconds and 4 git commands to generate.