From 6b10c48d5b91c11eddd20e93cec4bea00792b84b Mon Sep 17 00:00:00 2001 From: Michael Shalayeff Date: Mon, 4 Jun 2001 14:59:51 +0000 Subject: return from main() don't exit --- sbin/ancontrol/ancontrol.c | 5 ++-- sbin/atactl/atactl.c | 5 ++-- sbin/ccdconfig/ccdconfig.c | 17 +++++-------- sbin/clri/clri.c | 12 ++++----- sbin/dmesg/dmesg.c | 8 +++--- sbin/dumplfs/dumplfs.c | 6 ++--- sbin/edlabel/edlabel.c | 7 +++--- sbin/lmccontrol/lmccontrol.c | 26 +++++++++---------- sbin/nfsd/nfsd.c | 60 ++++++++++++++++++++++---------------------- sbin/pdisk/pdisk.c | 2 +- sbin/raidctl/raidctl.c | 6 ++--- sbin/reboot/reboot.c | 10 ++++---- sbin/restore/main.c | 5 ++-- sbin/savecore/savecore.c | 12 ++++----- sbin/savecore/savecore_old.c | 12 ++++----- sbin/swapctl/swapctl.c | 26 +++++++++---------- sbin/sysctl/pathconf.c | 8 +++--- sbin/wicontrol/wicontrol.c | 6 ++--- 18 files changed, 114 insertions(+), 119 deletions(-) (limited to 'sbin') diff --git a/sbin/ancontrol/ancontrol.c b/sbin/ancontrol/ancontrol.c index 13841dbf278..21841975e7f 100644 --- a/sbin/ancontrol/ancontrol.c +++ b/sbin/ancontrol/ancontrol.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ancontrol.c,v 1.16 2001/05/02 22:31:09 ericj Exp $ */ +/* $OpenBSD: ancontrol.c,v 1.17 2001/06/04 14:59:46 mickey Exp $ */ /* * Copyright (c) 2001 Eric Jackson * @@ -1476,5 +1476,6 @@ main(argc, argv) /* Close our socket */ if (s) close(s); - exit(0); + + return (0); } diff --git a/sbin/atactl/atactl.c b/sbin/atactl/atactl.c index c9dd66df47f..57791cd6f7c 100644 --- a/sbin/atactl/atactl.c +++ b/sbin/atactl/atactl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atactl.c,v 1.6 2001/03/23 02:16:42 deraadt Exp $ */ +/* $OpenBSD: atactl.c,v 1.7 2001/06/04 14:59:47 mickey Exp $ */ /* $NetBSD: atactl.c,v 1.4 1999/02/24 18:49:14 jwise Exp $ */ /*- @@ -242,7 +242,8 @@ main(argc, argv) errx(1, "unknown command: %s\n", cmdname); (*commands[i].cmd_func)(argc, argv); - exit(0); + + return (0); } void diff --git a/sbin/ccdconfig/ccdconfig.c b/sbin/ccdconfig/ccdconfig.c index e4da9d2ce91..6db794497cb 100644 --- a/sbin/ccdconfig/ccdconfig.c +++ b/sbin/ccdconfig/ccdconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ccdconfig.c,v 1.14 2000/09/30 16:06:33 aaron Exp $ */ +/* $OpenBSD: ccdconfig.c,v 1.15 2001/06/04 14:59:47 mickey Exp $ */ /* $NetBSD: ccdconfig.c,v 1.6 1996/05/16 07:11:18 thorpej Exp $ */ /*- @@ -178,25 +178,20 @@ main(argc, argv) case CCD_UNCONFIG: setegid(getgid()); setgid(getgid()); - - exit(do_single(argc, argv, action)); - /* NOTREACHED */ + return (do_single(argc, argv, action)); case CCD_CONFIGALL: case CCD_UNCONFIGALL: - setegid(getgid()); setgid(getgid()); - - exit(do_all(action)); - /* NOTREACHED */ + return (do_all(action)); case CCD_DUMP: - exit(dump_ccd(argc, argv)); - /* NOTREACHED */ + return (dump_ccd(argc, argv)); } /* NOTREACHED */ - exit(0); + + return (0); } static int diff --git a/sbin/clri/clri.c b/sbin/clri/clri.c index 3bbbdfc8e7e..fe664c5f8a7 100644 --- a/sbin/clri/clri.c +++ b/sbin/clri/clri.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clri.c,v 1.4 1997/10/12 20:07:46 deraadt Exp $ */ +/* $OpenBSD: clri.c,v 1.5 2001/06/04 14:59:47 mickey Exp $ */ /* $NetBSD: clri.c,v 1.9 1995/03/18 14:54:33 cgd Exp $ */ /* @@ -47,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)clri.c 8.2 (Berkeley) 9/23/93"; #else -static char rcsid[] = "$OpenBSD: clri.c,v 1.4 1997/10/12 20:07:46 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: clri.c,v 1.5 2001/06/04 14:59:47 mickey Exp $"; #endif #endif /* not lint */ @@ -81,8 +81,8 @@ main(argc, argv) char *fs, sblock[SBSIZE]; if (argc < 3) { - (void)fprintf(stderr, "usage: clri filesystem inode ...\n"); - exit(1); + fprintf(stderr, "usage: clri filesystem inode ...\n"); + return (1); } fs = *++argv; @@ -143,6 +143,6 @@ main(argc, argv) errx(1, "%s: can't update superblock", fs); } } - (void)close(fd); - exit(0); + + return close(fd); } diff --git a/sbin/dmesg/dmesg.c b/sbin/dmesg/dmesg.c index 2d14d1f3b68..576d6ca6227 100644 --- a/sbin/dmesg/dmesg.c +++ b/sbin/dmesg/dmesg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dmesg.c,v 1.8 2000/02/22 19:27:38 deraadt Exp $ */ +/* $OpenBSD: dmesg.c,v 1.9 2001/06/04 14:59:47 mickey Exp $ */ /* $NetBSD: dmesg.c,v 1.8 1995/03/18 14:54:49 cgd Exp $ */ /*- @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)dmesg.c 8.1 (Berkeley) 6/5/93"; #else -static char rcsid[] = "$OpenBSD: dmesg.c,v 1.8 2000/02/22 19:27:38 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: dmesg.c,v 1.9 2001/06/04 14:59:47 mickey Exp $"; #endif #endif /* not lint */ @@ -112,7 +112,7 @@ main(argc, argv) /* Read in kernel message buffer, do sanity checks. */ if ((kd = kvm_open(nlistf, memf, NULL, O_RDONLY, "dmesg")) == NULL) - exit (1); + return (1); setegid(getgid()); setgid(getgid()); @@ -169,7 +169,7 @@ main(argc, argv) } if (!newl) (void)putchar('\n'); - exit(0); + return (0); } void diff --git a/sbin/dumplfs/dumplfs.c b/sbin/dumplfs/dumplfs.c index 0f0139a0865..2bddb5387ca 100644 --- a/sbin/dumplfs/dumplfs.c +++ b/sbin/dumplfs/dumplfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dumplfs.c,v 1.4 1996/06/23 14:30:18 deraadt Exp $ */ +/* $OpenBSD: dumplfs.c,v 1.5 2001/06/04 14:59:48 mickey Exp $ */ /* $NetBSD: dumplfs.c,v 1.7 1995/12/14 22:36:34 thorpej Exp $ */ /*- @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)dumplfs.c 8.1 (Berkeley) 6/5/93"; #else -static char rcsid[] = "$OpenBSD: dumplfs.c,v 1.4 1996/06/23 14:30:18 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: dumplfs.c,v 1.5 2001/06/04 14:59:48 mickey Exp $"; #endif #endif /* not lint */ @@ -179,7 +179,7 @@ main(argc, argv) segnum, seg_addr, lfs_master, do_allsb); (void)close(fd); - exit(0); + return (0); } /* diff --git a/sbin/edlabel/edlabel.c b/sbin/edlabel/edlabel.c index c6f08df97ee..b9110dcf7cb 100644 --- a/sbin/edlabel/edlabel.c +++ b/sbin/edlabel/edlabel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: edlabel.c,v 1.5 2000/08/05 21:40:14 pjanzen Exp $ */ +/* $OpenBSD: edlabel.c,v 1.6 2001/06/04 14:59:48 mickey Exp $ */ /* $NetBSD: edlabel.c,v 1.1.1.1 1995/10/08 22:39:09 gwr Exp $ */ /* @@ -517,7 +517,7 @@ main(argc, argv) if (argc != 2) { fprintf(stderr, "usage: edlabel RAWDISK\n"); - exit(1); + return (1); } devname = argv[1]; @@ -543,6 +543,7 @@ main(argc, argv) found: cmd->cmd_func(&dl, devname); } - exit(0); + + return (0); } diff --git a/sbin/lmccontrol/lmccontrol.c b/sbin/lmccontrol/lmccontrol.c index 85977b02d0c..fe25efad3d2 100644 --- a/sbin/lmccontrol/lmccontrol.c +++ b/sbin/lmccontrol/lmccontrol.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lmccontrol.c,v 1.2 2000/10/13 19:27:11 chris Exp $ */ +/* $OpenBSD: lmccontrol.c,v 1.3 2001/06/04 14:59:48 mickey Exp $ */ /*- * Copyright (c) 1997-1999 LAN Media Corporation (LMC) @@ -168,9 +168,9 @@ main(int argc, char **argv) if (ioctl(fd, SPPPIOCCISCO, &ifr) < 0) { fprintf(stderr, "ioctl %s SPPPIOCCISCO: %s\n", ifr.ifr_name, strerror(errno)); - exit(1); + return (1); } - exit(0); + return (0); #else fprintf (stderr, "This option is not yet supported\n"); #endif @@ -179,7 +179,7 @@ main(int argc, char **argv) fd = socket(AF_INET, SOCK_DGRAM, 0); if (fd < 0) { fprintf(stderr, "socket: %s\n", strerror(errno)); - exit(1); + return (1); } strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); @@ -188,9 +188,9 @@ main(int argc, char **argv) if (ioctl(fd, SPPPIOCPPP, &ifr) < 0) { fprintf(stderr, "ioctl %s SPPPIOCPPP: %s\n", ifr.ifr_name, strerror(errno)); - exit(1); + return (1); } - exit(0); + return (0); #else fprintf(stderr, "This option is not yet supported\n"); #endif @@ -198,14 +198,14 @@ main(int argc, char **argv) case 'h': case '?': usage(argv[0]); - exit(0); + return (0); } } fd = socket(AF_INET, SOCK_DGRAM, 0); if (fd < 0) { fprintf(stderr, "socket: %s\n", strerror(errno)); - exit(1); + return (1); } strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); @@ -217,7 +217,7 @@ main(int argc, char **argv) if (ioctl(fd, LMCIOCGINFO, &ifr) < 0) { fprintf(stderr, "ioctl %s LMCIOCGINFO: %s\n", ifr.ifr_name, strerror(errno)); - exit(1); + return (1); } /* @@ -225,7 +225,7 @@ main(int argc, char **argv) */ if (just_print) { dumpdata(ifname, &ctl); - exit(0); + return (0); } if (flag_c) @@ -234,7 +234,7 @@ main(int argc, char **argv) lmc_av9110_freq(wanted.clock_rate, &wanted.cardspec.ssi); if (wanted.cardspec.ssi.f == 0) { printf("Unable to calculate requested rate.\n"); - exit(1); + return (1); } if (wanted.cardspec.ssi.exact == 0) printf("Unable to calculate exact frequency," @@ -284,10 +284,10 @@ main(int argc, char **argv) if (ioctl(fd, LMCIOCSINFO, &ifr) < 0) { fprintf(stderr, "ioctl %s LMCIOCSINFO: %s\n", ifr.ifr_name, strerror(errno)); - exit(1); + return (1); } - exit(0); + return (0); } char *clock_sources[] = { diff --git a/sbin/nfsd/nfsd.c b/sbin/nfsd/nfsd.c index ef985dc782d..6deadf87ccf 100644 --- a/sbin/nfsd/nfsd.c +++ b/sbin/nfsd/nfsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfsd.c,v 1.12 2001/01/19 17:57:40 deraadt Exp $ */ +/* $OpenBSD: nfsd.c,v 1.13 2001/06/04 14:59:48 mickey Exp $ */ /* $NetBSD: nfsd.c,v 1.19 1996/02/18 23:18:56 mycroft Exp $ */ /* @@ -238,7 +238,7 @@ main(argc, argv, envp) (!pmap_set(RPCPROG_NFS, 2, IPPROTO_TCP, NFS_PORT) || !pmap_set(RPCPROG_NFS, 3, IPPROTO_TCP, NFS_PORT))) err(1, "can't register with portmap for TCP."); - exit(0); + return (0); } openlog("nfsd:", LOG_PID, LOG_DAEMON); @@ -246,7 +246,7 @@ main(argc, argv, envp) switch (fork()) { case -1: syslog(LOG_ERR, "fork: %m"); - exit (1); + return (1); case 0: break; default: @@ -268,7 +268,7 @@ main(argc, argv, envp) while (nfssvc(nfssvc_flag, &nsd) < 0) { if (errno != ENEEDAUTH) { syslog(LOG_ERR, "nfssvc: %m"); - exit(1); + return (1); } nfssvc_flag = NFSSVC_NFSD | NFSSVC_AUTHINFAIL; #ifdef NFSKERB @@ -342,14 +342,14 @@ main(argc, argv, envp) } #endif /* NFSKERB */ } - exit(0); + return (0); } /* If we are serving udp, set up the socket. */ if (udpflag) { if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { syslog(LOG_ERR, "can't create udp socket"); - exit(1); + return (1); } memset(&inetaddr, 0, sizeof inetaddr); inetaddr.sin_family = AF_INET; @@ -359,19 +359,19 @@ main(argc, argv, envp) if (bind(sock, (struct sockaddr *)&inetaddr, sizeof(inetaddr)) < 0) { syslog(LOG_ERR, "can't bind udp addr"); - exit(1); + return (1); } if (!pmap_set(RPCPROG_NFS, 2, IPPROTO_UDP, NFS_PORT) || !pmap_set(RPCPROG_NFS, 3, IPPROTO_UDP, NFS_PORT)) { syslog(LOG_ERR, "can't register with udp portmap"); - exit(1); + return (1); } nfsdargs.sock = sock; nfsdargs.name = NULL; nfsdargs.namelen = 0; if (nfssvc(NFSSVC_ADDSOCK, &nfsdargs) < 0) { syslog(LOG_ERR, "can't Add UDP socket"); - exit(1); + return (1); } (void)close(sock); } @@ -381,7 +381,7 @@ main(argc, argv, envp) if (cltpflag) { if ((sock = socket(AF_ISO, SOCK_DGRAM, 0)) < 0) { syslog(LOG_ERR, "can't create cltp socket"); - exit(1); + return (1); } memset(&isoaddr, 0, sizeof(isoaddr)); isoaddr.siso_family = AF_ISO; @@ -393,7 +393,7 @@ main(argc, argv, envp) if (bind(sock, (struct sockaddr *)&isoaddr, sizeof(isoaddr)) < 0) { syslog(LOG_ERR, "can't bind cltp addr"); - exit(1); + return (1); } #ifdef notyet /* @@ -403,7 +403,7 @@ main(argc, argv, envp) */ if (!pmap_set(RPCPROG_NFS, NFS_VER2, IPPROTO_UDP, NFS_PORT)) { syslog(LOG_ERR, "can't register with udp portmap"); - exit(1); + return (1); } #endif /* notyet */ nfsdargs.sock = sock; @@ -411,7 +411,7 @@ main(argc, argv, envp) nfsdargs.namelen = 0; if (nfssvc(NFSSVC_ADDSOCK, &nfsdargs) < 0) { syslog(LOG_ERR, "can't add UDP socket"); - exit(1); + return (1); } close(sock); } @@ -424,7 +424,7 @@ main(argc, argv, envp) if (tcpflag) { if ((tcpsock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { syslog(LOG_ERR, "can't create tcp socket"); - exit(1); + return (1); } if (setsockopt(tcpsock, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) < 0) @@ -437,16 +437,16 @@ main(argc, argv, envp) if (bind(tcpsock, (struct sockaddr *)&inetaddr, sizeof (inetaddr)) < 0) { syslog(LOG_ERR, "can't bind tcp addr"); - exit(1); + return (1); } if (listen(tcpsock, 5) < 0) { syslog(LOG_ERR, "listen failed"); - exit(1); + return (1); } if (!pmap_set(RPCPROG_NFS, 2, IPPROTO_TCP, NFS_PORT) || !pmap_set(RPCPROG_NFS, 3, IPPROTO_TCP, NFS_PORT)) { syslog(LOG_ERR, "can't register tcp with portmap"); - exit(1); + return (1); } FD_SET(tcpsock, &sockbits); maxsock = tcpsock; @@ -458,7 +458,7 @@ main(argc, argv, envp) if (tp4flag) { if ((tp4sock = socket(AF_ISO, SOCK_SEQPACKET, 0)) < 0) { syslog(LOG_ERR, "can't create tp4 socket"); - exit(1); + return (1); } if (setsockopt(tp4sock, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) < 0) @@ -473,11 +473,11 @@ main(argc, argv, envp) if (bind(tp4sock, (struct sockaddr *)&isoaddr, sizeof(isoaddr)) < 0) { syslog(LOG_ERR, "can't bind tp4 addr"); - exit(1); + return (1); } if (listen(tp4sock, 5) < 0) { syslog(LOG_ERR, "listen failed"); - exit(1); + return (1); } /* * XXX @@ -486,7 +486,7 @@ main(argc, argv, envp) */ if (!pmap_set(RPCPROG_NFS, NFS_VER2, IPPROTO_TCP, NFS_PORT)) { syslog(LOG_ERR, "can't register tcp with portmap"); - exit(1); + return (1); } FD_SET(tp4sock, &sockbits); maxsock = tp4sock; @@ -497,7 +497,7 @@ main(argc, argv, envp) if (tpipflag) { if ((tpipsock = socket(AF_INET, SOCK_SEQPACKET, 0)) < 0) { syslog(LOG_ERR, "can't create tpip socket"); - exit(1); + return (1); } if (setsockopt(tpipsock, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) < 0) @@ -510,11 +510,11 @@ main(argc, argv, envp) if (bind(tpipsock, (struct sockaddr *)&inetaddr, sizeof (inetaddr)) < 0) { syslog(LOG_ERR, "can't bind tcp addr"); - exit(1); + return (1); } if (listen(tpipsock, 5) < 0) { syslog(LOG_ERR, "listen failed"); - exit(1); + return (1); } /* * XXX @@ -523,7 +523,7 @@ main(argc, argv, envp) */ if (!pmap_set(RPCPROG_NFS, NFS_VER2, IPPROTO_TCP, NFS_PORT)) { syslog(LOG_ERR, "can't register tcp with portmap"); - exit(1); + return (1); } FD_SET(tpipsock, &sockbits); maxsock = tpipsock; @@ -532,7 +532,7 @@ main(argc, argv, envp) #endif /* notyet */ if (connect_type_cnt == 0) - exit(0); + return (0); setproctitle("master"); @@ -546,7 +546,7 @@ main(argc, argv, envp) if (select(maxsock + 1, &ready, NULL, NULL, NULL) < 1) { syslog(LOG_ERR, "select failed: %m"); - exit(1); + return (1); } } if (tcpflag && FD_ISSET(tcpsock, &ready)) { @@ -554,7 +554,7 @@ main(argc, argv, envp) if ((msgsock = accept(tcpsock, (struct sockaddr *)&inetpeer, &len)) < 0) { syslog(LOG_ERR, "accept failed: %m"); - exit(1); + return (1); } memset(inetpeer.sin_zero, 0, sizeof(inetpeer.sin_zero)); if (setsockopt(msgsock, SOL_SOCKET, @@ -573,7 +573,7 @@ main(argc, argv, envp) if ((msgsock = accept(tp4sock, (struct sockaddr *)&isopeer, &len)) < 0) { syslog(LOG_ERR, "accept failed: %m"); - exit(1); + return (1); } if (setsockopt(msgsock, SOL_SOCKET, SO_KEEPALIVE, (char *)&on, sizeof(on)) < 0) @@ -590,7 +590,7 @@ main(argc, argv, envp) if ((msgsock = accept(tpipsock, (struct sockaddr *)&inetpeer, &len)) < 0) { syslog(LOG_ERR, "Accept failed: %m"); - exit(1); + return (1); } if (setsockopt(msgsock, SOL_SOCKET, SO_KEEPALIVE, (char *)&on, sizeof(on)) < 0) diff --git a/sbin/pdisk/pdisk.c b/sbin/pdisk/pdisk.c index bba6273800e..b990482b2be 100644 --- a/sbin/pdisk/pdisk.c +++ b/sbin/pdisk/pdisk.c @@ -205,7 +205,7 @@ main(int argc, char **argv) SIOUXSettings.autocloseonquit = 1; //printf("Processing stopped: Choose 'Quit' from the file menu to quit.\n\n"); - exit(0); + return (0); #endif } diff --git a/sbin/raidctl/raidctl.c b/sbin/raidctl/raidctl.c index a23d69b3632..4e34089259c 100644 --- a/sbin/raidctl/raidctl.c +++ b/sbin/raidctl/raidctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raidctl.c,v 1.5 2000/01/11 18:03:45 peter Exp $ */ +/* $OpenBSD: raidctl.c,v 1.6 2001/06/04 14:59:49 mickey Exp $ */ /* $NetBSD: raidctl.c,v 1.11 2000/01/09 03:06:35 oster Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -252,7 +252,7 @@ main(argc,argv) if ((fd = open( dev_name, O_RDWR, 0640)) < 0) { fprintf(stderr, "%s: unable to open device file: %s\n", __progname, dev_name); - exit(1); + return (1); } @@ -317,7 +317,7 @@ main(argc,argv) } close(fd); - exit(0); + return (0); } void diff --git a/sbin/reboot/reboot.c b/sbin/reboot/reboot.c index f32a7f0a880..d86c4b1541d 100644 --- a/sbin/reboot/reboot.c +++ b/sbin/reboot/reboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: reboot.c,v 1.18 2000/04/30 17:30:34 millert Exp $ */ +/* $OpenBSD: reboot.c,v 1.19 2001/06/04 14:59:49 mickey Exp $ */ /* $NetBSD: reboot.c,v 1.8 1995/10/05 05:36:22 mycroft Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)reboot.c 8.1 (Berkeley) 6/5/93"; #else -static char rcsid[] = "$OpenBSD: reboot.c,v 1.18 2000/04/30 17:30:34 millert Exp $"; +static char rcsid[] = "$OpenBSD: reboot.c,v 1.19 2001/06/04 14:59:49 mickey Exp $"; #endif #endif /* not lint */ @@ -179,12 +179,12 @@ main(argc, argv) break; case 0: if (revoke(_PATH_CONSOLE) == -1) - perror("revoke"); + warn("revoke"); if (setsid() == -1) - perror("setsid"); + warn("setsid"); fd = open(_PATH_CONSOLE, O_RDWR); if (fd == -1) - perror("open"); + warn("open"); dup2(fd, 0); dup2(fd, 1); dup2(fd, 2); diff --git a/sbin/restore/main.c b/sbin/restore/main.c index ef4b043b8b8..3c945871d92 100644 --- a/sbin/restore/main.c +++ b/sbin/restore/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.9 1997/07/05 20:51:23 millert Exp $ */ +/* $OpenBSD: main.c,v 1.10 2001/06/04 14:59:49 mickey Exp $ */ /* $NetBSD: main.c,v 1.13 1997/07/01 05:37:51 lukem Exp $ */ /* @@ -285,8 +285,7 @@ main(argc, argv) checkrestore(); break; } - exit(0); - /* NOTREACHED */ + return (0); } static void diff --git a/sbin/savecore/savecore.c b/sbin/savecore/savecore.c index afacf6d09ca..1d4bbbee677 100644 --- a/sbin/savecore/savecore.c +++ b/sbin/savecore/savecore.c @@ -1,4 +1,4 @@ -/* $OpenBSD: savecore.c,v 1.23 2001/01/18 00:18:38 deraadt Exp $ */ +/* $OpenBSD: savecore.c,v 1.24 2001/06/04 14:59:49 mickey Exp $ */ /* $NetBSD: savecore.c,v 1.26 1996/03/18 21:16:05 leo Exp $ */ /*- @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)savecore.c 8.3 (Berkeley) 1/2/94"; #else -static char rcsid[] = "$OpenBSD: savecore.c,v 1.23 2001/01/18 00:18:38 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: savecore.c,v 1.24 2001/06/04 14:59:49 mickey Exp $"; #endif #endif /* not lint */ @@ -195,11 +195,11 @@ main(argc, argv) if (clear) { clear_dump(); - exit(0); + return (0); } if (!dump_exists() && !force) - exit(1); + return (1); check_kmem(); @@ -209,12 +209,12 @@ main(argc, argv) syslog(LOG_ALERT, "reboot"); if ((!get_crashtime() || !check_space()) && !force) - exit(1); + return (1); save_core(); clear_dump(); - exit(0); + return (0); } char *dump_sys; diff --git a/sbin/savecore/savecore_old.c b/sbin/savecore/savecore_old.c index 3c1b7086cac..2d64cebcaf9 100644 --- a/sbin/savecore/savecore_old.c +++ b/sbin/savecore/savecore_old.c @@ -1,4 +1,4 @@ -/* $OpenBSD: savecore_old.c,v 1.17 2001/01/18 00:18:38 deraadt Exp $ */ +/* $OpenBSD: savecore_old.c,v 1.18 2001/06/04 14:59:49 mickey Exp $ */ /* $NetBSD: savecore_old.c,v 1.1.1.1 1996/03/16 10:25:11 leo Exp $ */ /*- @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)savecore.c 8.3 (Berkeley) 1/2/94"; #else -static char rcsid[] = "$OpenBSD: savecore_old.c,v 1.17 2001/01/18 00:18:38 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: savecore_old.c,v 1.18 2001/06/04 14:59:49 mickey Exp $"; #endif #endif /* not lint */ @@ -192,11 +192,11 @@ main(argc, argv) if (clear) { clear_dump(); - exit(0); + return (0); } if (!dump_exists() && !force) - exit(1); + return (1); check_kmem(); @@ -206,12 +206,12 @@ main(argc, argv) syslog(LOG_ALERT, "reboot"); if ((!get_crashtime() || !check_space()) && !force) - exit(1); + return (1); save_core(); clear_dump(); - exit(0); + return (0); } void diff --git a/sbin/swapctl/swapctl.c b/sbin/swapctl/swapctl.c index f59632e44a9..7f065d7b78e 100644 --- a/sbin/swapctl/swapctl.c +++ b/sbin/swapctl/swapctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: swapctl.c,v 1.5 2001/06/02 03:04:44 miod Exp $ */ +/* $OpenBSD: swapctl.c,v 1.6 2001/06/04 14:59:50 mickey Exp $ */ /* $NetBSD: swapctl.c,v 1.9 1998/07/26 20:23:15 mycroft Exp $ */ /* @@ -111,7 +111,7 @@ static void del_swap __P((char *)); int main __P((int, char *[])); static void do_fstab __P((void)); static void usage __P((void)); -static void swapon_command __P((int, char **)); +static int swapon_command __P((int, char **)); #if 0 static void swapoff_command __P((int, char **)); #endif @@ -125,10 +125,8 @@ main(argc, argv) { int c; - if (strcmp(__progname, "swapon") == 0) { - swapon_command(argc, argv); - /* NOTREACHED */ - } + if (strcmp(__progname, "swapon") == 0) + return swapon_command(argc, argv); #if 0 if (strcmp(__progname, "swapoff") == 0) { @@ -247,13 +245,13 @@ main(argc, argv) break; } - exit(0); + return (0); } /* * swapon_command: emulate the old swapon(8) program. */ -void +int swapon_command(argc, argv) int argc; char **argv; @@ -287,7 +285,7 @@ swapon_command(argc, argv) usage(); } do_fstab(); - exit(0); + return (0); } else if (argc == 0 || tflag != NULL) goto swapon_usage; @@ -296,13 +294,13 @@ swapon_command(argc, argv) argc--; argv++; } - exit(0); - /* NOTREACHED */ + return (0); swapon_usage: - fprintf(stderr, "usage: %s -a [-t blk|noblk]\n", __progname); - fprintf(stderr, " %s ...\n", __progname); - exit(1); + fprintf(stderr, "usage: %s -a [-t blk|noblk]\n" + " %s ...\n", + __progname, __progname); + return (1); } /* diff --git a/sbin/sysctl/pathconf.c b/sbin/sysctl/pathconf.c index 398732d8f9b..8cd574cddac 100644 --- a/sbin/sysctl/pathconf.c +++ b/sbin/sysctl/pathconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pathconf.c,v 1.4 2001/01/28 22:45:20 niklas Exp $ */ +/* $OpenBSD: pathconf.c,v 1.5 2001/06/04 14:59:50 mickey Exp $ */ /* $NetBSD: pathconf.c,v 1.2 1995/09/30 07:12:47 thorpej Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)pathconf.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$OpenBSD: pathconf.c,v 1.4 2001/01/28 22:45:20 niklas Exp $"; +static char rcsid[] = "$OpenBSD: pathconf.c,v 1.5 2001/06/04 14:59:50 mickey Exp $"; #endif #endif /* not lint */ @@ -120,13 +120,13 @@ main(argc, argv) argc--; if (Aflag || aflag) { listall(path, &pclist); - exit(0); + return (0); } if (argc == 0) usage(); while (argc-- > 0) parse(path, *argv, 1); - exit(0); + return (0); } /* diff --git a/sbin/wicontrol/wicontrol.c b/sbin/wicontrol/wicontrol.c index 0110544800f..f2315ec0c46 100644 --- a/sbin/wicontrol/wicontrol.c +++ b/sbin/wicontrol/wicontrol.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wicontrol.c,v 1.13 2001/05/15 02:40:36 millert Exp $ */ +/* $OpenBSD: wicontrol.c,v 1.14 2001/06/04 14:59:50 mickey Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -66,7 +66,7 @@ static const char copyright[] = "@(#) Copyright (c) 1997, 1998, 1999\ Bill Paul. All rights reserved."; static const char rcsid[] = - "@(#) $Id: wicontrol.c,v 1.13 2001/05/15 02:40:36 millert Exp $"; + "@(#) $Id: wicontrol.c,v 1.14 2001/06/04 14:59:50 mickey Exp $"; #endif static void wi_getval __P((char *, struct wi_req *)); @@ -701,5 +701,5 @@ int main(argc, argv) if (dumpinfo && !dumpstats) wi_dumpinfo(iface); - exit(0); + return (0); } -- cgit v1.2.3