(file) Return to pidfile.c CVS log (file) (dir) Up to [OMI] / omi / base

Diff for /omi/base/pidfile.c between version 1.2 and 1.3

version 1.2, 2015/04/20 18:10:09 version 1.3, 2015/04/20 18:19:50
Line 42 
Line 42 
     int fd;     int fd;
  
     /* Open the PID file */     /* Open the PID file */
     fd = open(GetPath(ID_PIDFILE), O_WRONLY|O_CREAT|O_TRUNC, 0640);      fd = open(OMI_GetPath(ID_PIDFILE), O_WRONLY|O_CREAT|O_TRUNC, 0640);
     if (fd == -1)     if (fd == -1)
     {     {
         /* Possibly errno=EWOULDBLOCK */         /* Possibly errno=EWOULDBLOCK */
Line 79 
Line 79 
     if (PIDFile_Read(&pid) != 0 || pid != getpid())     if (PIDFile_Read(&pid) != 0 || pid != getpid())
         return -1;         return -1;
  
     if (unlink(GetPath(ID_PIDFILE)) != 0)      if (unlink(OMI_GetPath(ID_PIDFILE)) != 0)
         return -1;         return -1;
  
     return 0;     return 0;
Line 90 
Line 90 
     int fd;     int fd;
  
     /* Open PID File */     /* Open PID File */
     fd = open(GetPath(ID_PIDFILE), O_RDONLY);      fd = open(OMI_GetPath(ID_PIDFILE), O_RDONLY);
     if (fd == -1)     if (fd == -1)
         return -1;         return -1;
  
Line 151 
Line 151 
     int fd;     int fd;
  
     /* Open the PID file for write */     /* Open the PID file for write */
     if ((fd = open(GetPath(ID_PIDFILE), O_WRONLY | O_NONBLOCK, 0640)) == -1)      if ((fd = open(OMI_GetPath(ID_PIDFILE), O_WRONLY | O_NONBLOCK, 0640)) == -1)
     {     {
         return -1;         return -1;
     }     }
Line 164 
Line 164 
         if (r == 0)         if (r == 0)
         {         {
             /* Remove stale PID file */             /* Remove stale PID file */
             unlink(GetPath(ID_PIDFILE));              unlink(OMI_GetPath(ID_PIDFILE));
  
             close(fd);             close(fd);
             return -1;             return -1;
Line 174 
Line 174 
     }     }
  
     /* Fail if PIDFILE does not exist */     /* Fail if PIDFILE does not exist */
     if (access(GetPath(ID_PIDFILE), R_OK) != 0)      if (access(OMI_GetPath(ID_PIDFILE), R_OK) != 0)
     {     {
         return -1;         return -1;
     }     }


Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

ViewCVS 0.9.2