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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines