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

Comparing gvpe/src/util.C (file contents):
Revision 1.14 by pcg, Mon May 10 20:13:10 2004 UTC vs.
Revision 1.15 by pcg, Fri Jun 11 15:56:34 2004 UTC

1/* 1/*
2 util.C -- process management and other utility functions 2 util.C -- process management and other utility functions
3 Copyright (C) 2003 Marc Lehmann <pcg@goof.com> 3 Copyright (C) 2003-2004 Marc Lehmann <pcg@goof.com>
4 4
5 Some of these are taken from tinc, see the AUTHORS file. 5 Some of these are taken from tinc, see the AUTHORS file.
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
50 50
51 pid = check_pid (conf.pidfilename); 51 pid = check_pid (conf.pidfilename);
52 52
53 if (pid) 53 if (pid)
54 { 54 {
55 fprintf (stderr, _("A vped is already running with pid %d.\n"), pid); 55 fprintf (stderr, _("A gvpe daemon is already running with pid %d.\n"), pid);
56 return 1; 56 return 1;
57 } 57 }
58 58
59 /* if it's locked, write-protected, or whatever */ 59 /* if it's locked, write-protected, or whatever */
60 if (!write_pid (conf.pidfilename)) 60 if (!write_pid (conf.pidfilename))
70 70
71 pid = read_pid (conf.pidfilename); 71 pid = read_pid (conf.pidfilename);
72 72
73 if (!pid) 73 if (!pid)
74 { 74 {
75 fprintf (stderr, _("No other vped is running.\n")); 75 fprintf (stderr, _("No other gvpe daemon is running.\n"));
76 return 1; 76 return 1;
77 } 77 }
78 78
79 errno = 0; /* No error, sometimes errno is only changed on error */ 79 errno = 0; /* No error, sometimes errno is only changed on error */
80 80
81 /* ESRCH is returned when no process with that pid is found */ 81 /* ESRCH is returned when no process with that pid is found */
82 if (kill (pid, signal) && errno == ESRCH) 82 if (kill (pid, signal) && errno == ESRCH)
83 { 83 {
84 fprintf (stderr, _("The vped is no longer running. ")); 84 fprintf (stderr, _("The gvpe daemon is no longer running. "));
85 85
86 fprintf (stderr, _("Removing stale lock file.\n")); 86 fprintf (stderr, _("Removing stale lock file.\n"));
87 remove_pid (conf.pidfilename); 87 remove_pid (conf.pidfilename);
88 } 88 }
89 89
120 log_to (LOGTO_SYSLOG); 120 log_to (LOGTO_SYSLOG);
121 } 121 }
122 else 122 else
123 log_to (LOGTO_SYSLOG | LOGTO_STDERR); 123 log_to (LOGTO_SYSLOG | LOGTO_STDERR);
124 124
125 slog (L_INFO, _("vped %s (%s %s) starting"), VERSION, __DATE__, __TIME__); 125 slog (L_INFO, _("gvpe daemon %s (%s %s) starting"), VERSION, __DATE__, __TIME__);
126 126
127 return 0; 127 return 0;
128} 128}
129 129
130void run_script (const run_script_cb &cb, bool wait) 130void run_script (const run_script_cb &cb, bool wait)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines