#define gtk_close()
#define gtk_redraw()
#define gtk_keyaction() 0
-#define gtk_loop() {fprintf (stderr, "No GTK support. Sorry.\n"); exit (1); }
+#define gtk_loop() {fprintf (stderr, "No GTK support. Sorry.\n"); exit(EXIT_FAILURE); }
#else
#include "mtr-gtk.h"
#endif
if (pipe (todns) < 0) {
perror ("can't make a pipe for DNS process");
- exit (-1);
+ exit(EXIT_FAILURE);
}
if (pipe (fromdns) < 0) {
perror ("can't make a pipe for DNS process");
- exit (-1);
+ exit(EXIT_FAILURE);
}
fflush (stdout);
pid = fork ();
//pid = 1;
if (pid < 0) {
perror ("can't fork for DNS process");
- exit (-1);
+ exit(EXIT_FAILURE);
}
if (pid == 0) {
char buf[2048];
// Automatically reap children.
if (signal(SIGCHLD, SIG_IGN) == SIG_ERR) {
perror("signal");
- exit(1);
+ exit(EXIT_FAILURE);
}
#if 0
if (rv < 0) perror ("write DNS lookup result");
}
- exit (0);
+ exit(EXIT_SUCCESS);
}
}
- exit (0);
+ exit(EXIT_SUCCESS);
} else {
int flags;
WaitTime = atof (optarg);
if (WaitTime <= 0.0) {
fprintf (stderr, "mtr: wait time must be positive\n");
- exit (1);
+ exit(EXIT_FAILURE);
}
if (getuid() != 0 && WaitTime < 1.0) {
fprintf (stderr, "non-root users cannot request an interval < 1.0 seconds\r\n");
- exit (1);
+ exit(EXIT_FAILURE);
}
break;
case 'f':
/* Check option before passing it on to fld_active. */
if (strlen (optarg) > MAXFLD) {
fprintf (stderr, "Too many fields: %s\n", optarg);
- exit (1);
+ exit(EXIT_FAILURE);
}
for (i=0; optarg[i]; i++) {
if(!strchr (available_options, optarg[i])) {
fprintf (stderr, "Unknown field identifier: %c\n", optarg[i]);
- exit (1);
+ exit(EXIT_FAILURE);
}
}
strcpy ((char*)fld_active, optarg);
GraceTime = atof (optarg);
if (GraceTime <= 0.0) {
fprintf (stderr, "mtr: wait time must be positive\n");
- exit (1);
+ exit(EXIT_FAILURE);
}
break;
case 'Q':
/* Now drop to user permissions */
if (setgid(getgid()) || setuid(getuid())) {
fprintf (stderr, "mtr: Unable to drop permissions.\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
/* Double check, just in case */
if ((geteuid() != getuid()) || (getegid() != getgid())) {
fprintf (stderr, "mtr: Unable to drop permissions.\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
/* reset the random seed */
if (PrintVersion) {
printf ("mtr " PACKAGE_VERSION "\n");
- exit(0);
+ exit(EXIT_SUCCESS);
}
if (PrintHelp) {