ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gvpe/src/vped.C
(Generate patch)

Comparing gvpe/src/vped.C (file contents):
Revision 1.13 by pcg, Thu Oct 16 21:57:54 2003 UTC vs.
Revision 1.18 by pcg, Mon May 10 20:13:10 2004 UTC

21 21
22#include "config.h" 22#include "config.h"
23 23
24#include <cstdio> 24#include <cstdio>
25#include <cstring> 25#include <cstring>
26#include <cstdlib>
27#include <clocale>
26 28
27#include <errno.h> 29#include <errno.h>
28#include <fcntl.h> 30#include <fcntl.h>
29#include <getopt.h> 31#include <getopt.h>
30#include <signal.h> 32#include <signal.h>
147*/ 149*/
148void cleanup_and_exit(int c) 150void cleanup_and_exit(int c)
149{ 151{
150 network.shutdown_all (); 152 network.shutdown_all ();
151 153
152 if (pidfilename) 154 if (conf.pidfilename)
153 remove_pid (pidfilename); 155 remove_pid (conf.pidfilename);
154 156
155 slog (L_INFO, _("terminating with exit code %d"), c); 157 slog (L_INFO, _("terminating with exit code %d"), c);
156 158
157 exit (c); 159 exit (c);
158} 160}
244 if (do_mlock) 246 if (do_mlock)
245 if (mlockall (MCL_CURRENT | MCL_FUTURE)) 247 if (mlockall (MCL_CURRENT | MCL_FUTURE))
246 slog (L_ERR, _("system call `%s' failed: %s"), "mlockall", strerror (errno)); 248 slog (L_ERR, _("system call `%s' failed: %s"), "mlockall", strerror (errno));
247#endif 249#endif
248 250
249 make_names ();
250 conf.read_config (true); 251 conf.read_config (true);
251 252
252 set_loglevel (llevel != L_NONE ? llevel : conf.llevel); 253 set_loglevel (llevel != L_NONE ? llevel : conf.llevel);
253 254
254 RAND_load_file ("/dev/urandom", 1024); 255 RAND_load_file ("/dev/urandom", 1024);
255 256
256 if (!THISNODE) 257 if (!THISNODE)
257 { 258 {
258 slog (L_ERR, _("current node not set, or node '%s' not found in configfile, use the -n switch when starting vped."), 259 slog (L_ERR, _("current node not set, or node '%s' not found in configfile, specify the nodename when starting vped."),
259 thisnode ? thisnode : "<unset>"); 260 thisnode ? thisnode : "<unset>");
260 exit (1); 261 exit (EXIT_FAILURE);
261 } 262 }
262 263
263 if (detach (do_detach)) 264 if (detach (do_detach))
264 exit (0); 265 exit (EXIT_SUCCESS);
265 266
266 setup_signals (); 267 setup_signals ();
267 268
268 if (!network.setup ()) 269 if (!network.setup ())
269 { 270 {
270 iom.loop (); 271 iom.loop ();
271 cleanup_and_exit (1); 272 cleanup_and_exit (EXIT_FAILURE);
272 } 273 }
273 274
274 slog (L_ERR, _("unable to setup network, unrecoverable error, exiting.")); 275 slog (L_ERR, _("unable to setup network, unrecoverable error, exiting."));
275 cleanup_and_exit (1); 276 cleanup_and_exit (EXIT_FAILURE);
276} 277}
277 278

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines