comparison svr-main.c @ 323:3bfbe95f9a14

Add -P pidfile patch from Swen Schillig
author Matt Johnston <matt@ucc.asn.au>
date Wed, 07 Jun 2006 14:10:21 +0000
parents 7dad470ad4aa
children b66a00272a90
comparison
equal deleted inserted replaced
322:84aa4e60bd3c 323:3bfbe95f9a14
144 } else { 144 } else {
145 dropbear_log(LOG_INFO, "Not forking"); 145 dropbear_log(LOG_INFO, "Not forking");
146 } 146 }
147 147
148 /* create a PID file so that we can be killed easily */ 148 /* create a PID file so that we can be killed easily */
149 pidfile = fopen(DROPBEAR_PIDFILE, "w"); 149 pidfile = fopen(svr_opts.pidfile, "w");
150 if (pidfile) { 150 if (pidfile) {
151 fprintf(pidfile, "%d\n", getpid()); 151 fprintf(pidfile, "%d\n", getpid());
152 fclose(pidfile); 152 fclose(pidfile);
153 } 153 }
154 154
187 } 187 }
188 188
189 val = select(maxsock+1, &fds, NULL, NULL, &seltimeout); 189 val = select(maxsock+1, &fds, NULL, NULL, &seltimeout);
190 190
191 if (exitflag) { 191 if (exitflag) {
192 unlink(DROPBEAR_PIDFILE); 192 unlink(svr_opts.pidfile);
193 dropbear_exit("Terminated by signal"); 193 dropbear_exit("Terminated by signal");
194 } 194 }
195 195
196 if (val == 0) { 196 if (val == 0) {
197 /* timeout reached */ 197 /* timeout reached */