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

Comparing gvpe/src/vpectrl.C (file contents):
Revision 1.6 by pcg, Thu Oct 16 21:57:54 2003 UTC vs.
Revision 1.9 by pcg, Thu Jan 29 18:55: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>
124 kill_vped = SIGKILL; 126 kill_vped = SIGKILL;
125 else if (!strcasecmp (optarg, "USR1")) 127 else if (!strcasecmp (optarg, "USR1"))
126 kill_vped = SIGUSR1; 128 kill_vped = SIGUSR1;
127 else if (!strcasecmp (optarg, "USR2")) 129 else if (!strcasecmp (optarg, "USR2"))
128 kill_vped = SIGUSR2; 130 kill_vped = SIGUSR2;
129 else if (!strcasecmp (optarg, "WINCH"))
130 kill_vped = SIGWINCH;
131 else if (!strcasecmp (optarg, "INT")) 131 else if (!strcasecmp (optarg, "INT"))
132 kill_vped = SIGINT; 132 kill_vped = SIGINT;
133 else if (!strcasecmp (optarg, "ALRM")) 133 else if (!strcasecmp (optarg, "ALRM"))
134 kill_vped = SIGALRM; 134 kill_vped = SIGALRM;
135 else 135 else
236 f = fopen (fname, "a"); 236 f = fopen (fname, "a");
237 237
238 if (!f) 238 if (!f)
239 { 239 {
240 perror (fname); 240 perror (fname);
241 exit (1); 241 exit (EXIT_FAILURE);
242 } 242 }
243 243
244 if (ftell (f)) 244 if (ftell (f))
245 { 245 {
246 fprintf (stderr, "'%s' already exists, skipping this node\n", 246 fprintf (stderr, "'%s' already exists, skipping this node\n",
260 return -1; 260 return -1;
261 } 261 }
262 else 262 else
263 fprintf (stderr, _("Done.\n")); 263 fprintf (stderr, _("Done.\n"));
264 264
265 PEM_write_RSAPublicKey (f, rsa_key); 265 require (PEM_write_RSAPublicKey (f, rsa_key));
266 fclose (f); 266 fclose (f);
267 free (fname); 267 free (fname);
268 268
269 asprintf (&fname, "%s/hostkeys/%s", confbase, node->nodename); 269 asprintf (&fname, "%s/hostkeys/%s", confbase, node->nodename);
270 270
271 f = fopen (fname, "a"); 271 f = fopen (fname, "a");
272 if (!f) 272 if (!f)
273 { 273 {
274 perror (fname); 274 perror (fname);
275 exit (1); 275 exit (EXIT_FAILURE);
276 } 276 }
277 277
278 PEM_write_RSAPrivateKey (f, rsa_key, NULL, NULL, 0, NULL, NULL); 278 require (PEM_write_RSAPrivateKey (f, rsa_key, NULL, NULL, 0, NULL, NULL));
279 fclose (f); 279 fclose (f);
280 free (fname); 280 free (fname);
281 } 281 }
282 282
283 return 0; 283 return 0;
326 exit (kill_other (kill_vped)); 326 exit (kill_other (kill_vped));
327 327
328 if (show_config) 328 if (show_config)
329 { 329 {
330 conf.print (); 330 conf.print ();
331 exit (0); 331 exit (EXIT_SUCCESS);
332 } 332 }
333 333
334 usage (1); 334 usage (1);
335} 335}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines