- Timestamp:
- Oct 1, 2007, 11:10:20 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/samba/source/lib/pidfile.c
r77 r96 39 39 return 0; 40 40 } 41 41 42 fd = sys_open(pidFile, O_NONBLOCK | O_RDONLY, 0644); 42 43 if (fd == -1) { … … 50 51 goto noproc; 51 52 } 52 53 53 ret = atoi(pidstr); 54 54 if (ret == 0) { … … 64 64 goto noproc; 65 65 } 66 67 66 #ifndef __OS2__ 68 67 /* if we lock the file, we won't be able to read it later on OS/2 */ … … 77 76 78 77 noproc: 78 #ifndef __OS2__ 79 79 SAFE_FREE(pidFile); 80 80 close(fd); 81 81 unlink(pidFile); 82 #else 83 close(fd); 84 unlink(pidFile); 85 SAFE_FREE(pidFile); 86 #endif 82 87 return 0; 83 88 } … … 113 118 #else 114 119 /* On OS/2, CONFIGFILE will always be different to dyn_CONFIGFILE as dyn_CONFIGFILE dynamically looks up the system ETC directory */ 115 strncpy( name, program_name, sizeof( name)-1);120 name = SMB_STRDUP(program_name); 116 121 #endif 117 122 if (asprintf(&pidFile, "%s/%s.pid", lp_piddir(), name) == -1) { … … 119 124 } 120 125 121 126 DEBUG(0,("PS1\n")); 122 127 pid = pidfile_pid(name); 128 DEBUG(0,("PS2\n")); 123 129 if (pid != 0) { 124 130 DEBUG(0,("ERROR: %s is already running. File %s exists and process id %d is running.\n", … … 139 145 exit(1); 140 146 } 141 142 147 memset(buf, 0, sizeof(buf)); 143 148 slprintf(buf, sizeof(buf) - 1, "%u\n", (unsigned int) sys_getpid());
Note:
See TracChangeset
for help on using the changeset viewer.