On Tue, 4 Jan 2000, Andy Igoshin wrote:

> Hi!
> 
> ����� ����������
> 
> oopsctl chkconfig
> 
> �� ���������� ������� � oopsctl:
> 
> oopsctl:connect: Connection refused

Da, bila vnesena oshibka v oopsctl.c. Patch priattachen.

> 
> 
> 
> --
> Andy Igoshin <[EMAIL PROTECTED]>                 Network Operation Center
> Phone: +7 (0732) 522406                             of
> Fax:   +7 (0732) 789820                  Voronezh State University
> =====================================================================
> If you would like to unsubscribe from this list send message to
> [EMAIL PROTECTED] with "unsubscribe oops" in message body.
> Archive is accessible on http://www.paco.net/oops/
> 

Igor Khasilev                |
PACO Links, [EMAIL PROTECTED]    |
*** modules/oopsctl.c.orig      Tue Jan  4 23:25:52 2000
--- modules/oopsctl.c   Wed Jan  5 00:19:54 2000
***************
*** 19,24 ****
--- 19,25 ----
  #include      <sys/file.h>
  #include      <sys/time.h>
  #include      <sys/un.h>
+ #include      <sys/wait.h>
  
  #include      <netinet/in.h>
  
***************
*** 122,133 ****
      }
      if ( !strcasecmp(*command, "chkconfig") ) {
        char    cmdpath[1024], cmdarg[1024];
- 
        sprintf(cmdpath,"%s/oops", OOPS_HOME);
        *(1+command) = cmdpath;
        execv(cmdpath, command+1);
        printf("Can't execute: %s\n", strerror(errno));
      }
      if ( !strcasecmp(*command,"stat") || 
         !strcasecmp(*command,"htmlstat") ||
         !strcasecmp(*command,"reconfigure") ||
--- 123,164 ----
      }
      if ( !strcasecmp(*command, "chkconfig") ) {
        char    cmdpath[1024], cmdarg[1024];
        sprintf(cmdpath,"%s/oops", OOPS_HOME);
+       sprintf(cmdarg, "-C%s/oops.cfg", OOPS_HOME);
        *(1+command) = cmdpath;
+       *(2+command) = cmdarg;
        execv(cmdpath, command+1);
        printf("Can't execute: %s\n", strerror(errno));
      }
+     if ( !strcasecmp(*command, "reconfigure") ) {
+       char    cmdpath[1024], cmdarg[1024];
+       pid_t   child;
+       int     stat;
+ 
+       /* first check if config is OK */
+       sprintf(cmdpath,"%s/oops", OOPS_HOME);
+       sprintf(cmdarg, "-C%s/oops.cfg", OOPS_HOME);
+       *(1+command) = cmdpath;
+       *(2+command) = cmdarg;
+       child = fork();
+       switch (child) {
+       case -1:
+               printf("Can't start child: %s\n", strerror(errno));
+               exit(1);
+       case 0:
+               execv(cmdpath, command+1);
+               printf("Can't execute: %s\n", strerror(errno));
+       default:
+               /* wait for child */
+               waitpid((pid_t)-1, &stat, 0);
+               if ( WIFEXITED(stat) && !WEXITSTATUS(stat) ) { /* ok */
+                   *(1+command) = NULL;
+                   goto srv_conn;
+               }
+               printf("Check config failed: exitcode: %d\n", WEXITSTATUS(stat));
+               exit(1);
+       }
+     }
      if ( !strcasecmp(*command,"stat") || 
         !strcasecmp(*command,"htmlstat") ||
         !strcasecmp(*command,"reconfigure") ||
***************
*** 135,140 ****
--- 166,172 ----
         !strcasecmp(*command,"stop") ||
         !strcasecmp(*command,"shutdown")
          ) {
+ srv_conn:
       /* connecting to server */
       oopsctl_so = socket(AF_UNIX, SOCK_STREAM, 0);
       if ( oopsctl_so == -1 ) {

Дати відповідь електронним листом