Cleanup shutdown(2) usage and make it consistent. The implementation in rsh
authorMatthew Dillon <dillon@dragonflybsd.org>
Fri, 18 May 2007 17:05:13 +0000 (17:05 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Fri, 18 May 2007 17:05:13 +0000 (17:05 +0000)
was particularly amusing.

Submitted-by: "Nuno Antunes" <nuno.antunes@gmail.com>
19 files changed:
libexec/ftp-proxy/ftp-proxy.c
libexec/rexecd/rexecd.c
libexec/rlogind/rlogind.c
libexec/rshd/rshd.c
libexec/telnetd/sys_term.c
sbin/disklabel/disklabel.c
sbin/mount_portal/activate.c
sys/netproto/ncp/ncp_sock.c
sys/netproto/smb/smb_trantcp.c
sys/vfs/nfs/nfs_socket.c
sys/vfs/nfs/nfs_syscalls.c
sys/vfs/portal/portal_vfsops.c
sys/vfs/portal/portal_vnops.c
usr.bin/rsh/rsh.c
usr.bin/telnet/commands.c
usr.sbin/IPXrouted/main.c
usr.sbin/faithd/rsh.c
usr.sbin/faithd/tcp.c
usr.sbin/rtsold/probe.c

index a69b51c..0cb15c2 100644 (file)
@@ -1,5 +1,5 @@
 /*     $OpenBSD: ftp-proxy.c,v 1.38 2004/11/19 00:47:23 jmc Exp $ */
-/*     $DragonFly: src/libexec/ftp-proxy/ftp-proxy.c,v 1.2 2005/02/24 15:38:09 joerg Exp $ */
+/*     $DragonFly: src/libexec/ftp-proxy/ftp-proxy.c,v 1.3 2007/05/18 17:05:10 dillon Exp $ */
 
 /*
  * Copyright (c) 1996-2001
@@ -186,7 +186,7 @@ static void
 close_client_data(void)
 {
        if (client_data_socket >= 0) {
-               shutdown(client_data_socket, 2);
+               shutdown(client_data_socket, SHUT_RDWR);
                close(client_data_socket);
                client_data_socket = -1;
        }
@@ -196,7 +196,7 @@ static void
 close_server_data(void)
 {
        if (server_data_socket >= 0)  {
-               shutdown(server_data_socket, 2);
+               shutdown(server_data_socket, SHUT_RDWR);
                close(server_data_socket);
                server_data_socket = -1;
        }
@@ -1353,14 +1353,14 @@ main(int argc, char *argv[])
                }
                free(fdsp);
                if (client_iob.got_eof) {
-                       shutdown(server_iob.fd, 1);
-                       shutdown(client_iob.fd, 0);
+                       shutdown(server_iob.fd, SHUT_WR);
+                       shutdown(client_iob.fd, SHUT_RD);
                        client_iob.got_eof = 0;
                        client_iob.alive = 0;
                }
                if (server_iob.got_eof) {
-                       shutdown(client_iob.fd, 1);
-                       shutdown(server_iob.fd, 0);
+                       shutdown(client_iob.fd, SHUT_WR);
+                       shutdown(server_iob.fd, SHUT_RD);
                        server_iob.got_eof = 0;
                        server_iob.alive = 0;
                }
index 847d42b..e5132f7 100644 (file)
@@ -33,7 +33,7 @@
  * @(#) Copyright (c) 1983, 1993 The Regents of the University of California.  All rights reserved.
  * @(#)rexecd.c        8.1 (Berkeley) 6/4/93
  * $FreeBSD: src/libexec/rexecd/rexecd.c,v 1.18.2.3 2002/05/14 22:27:21 des Exp $
- * $DragonFly: src/libexec/rexecd/rexecd.c,v 1.3 2003/11/14 03:54:30 dillon Exp $
+ * $DragonFly: src/libexec/rexecd/rexecd.c,v 1.4 2007/05/18 17:05:12 dillon Exp $
  */
 
 #include <sys/param.h>
@@ -254,7 +254,7 @@ doit(f, fromp)
                                if (ready & (1<<pv[0])) {
                                        cc = read(pv[0], buf, sizeof (buf));
                                        if (cc <= 0) {
-                                               shutdown(s, 1+1);
+                                               shutdown(s, SHUT_RDWR);
                                                readfrom &= ~(1<<pv[0]);
                                        } else
                                                (void) write(s, buf, cc);
index a55b213..ba50ff8 100644 (file)
@@ -33,7 +33,7 @@
  * @(#) Copyright (c) 1983, 1988, 1989, 1993 The Regents of the University of California.  All rights reserved.
  * @(#)rlogind.c       8.1 (Berkeley) 6/4/93
  * $FreeBSD: src/libexec/rlogind/rlogind.c,v 1.29.2.5 2000/12/07 15:02:31 ru Exp $
- * $DragonFly: src/libexec/rlogind/rlogind.c,v 1.4 2007/03/24 21:29:06 swildner Exp $
+ * $DragonFly: src/libexec/rlogind/rlogind.c,v 1.5 2007/05/18 17:05:12 dillon Exp $
  */
 
 /*
@@ -516,7 +516,7 @@ cleanup(int signo __unused)
        chflags(line, 0);
        chmod(line, 0666);
        chown(line, 0, 0);
-       shutdown(netf, 2);
+       shutdown(netf, SHUT_RDWR);
        exit(1);
 }
 
index ee1f6cc..5721999 100644 (file)
@@ -33,7 +33,7 @@
  * @(#) Copyright (c) 1988, 1989, 1992, 1993, 1994 The Regents of the University of California.  All rights reserved.
  * @(#)rshd.c  8.2 (Berkeley) 4/6/94
  * $FreeBSD: src/libexec/rshd/rshd.c,v 1.30.2.5 2002/05/14 22:27:21 des Exp $
- * $DragonFly: src/libexec/rshd/rshd.c,v 1.4 2007/03/24 21:52:14 swildner Exp $
+ * $DragonFly: src/libexec/rshd/rshd.c,v 1.5 2007/05/18 17:05:12 dillon Exp $
  */
 
 /*
@@ -277,7 +277,7 @@ doit(union sockunion *fromp)
                if ((cc = read(STDIN_FILENO, &c, 1)) != 1) {
                        if (cc < 0)
                                syslog(LOG_NOTICE, "read: %m");
-                       shutdown(0, 1+1);
+                       shutdown(0, SHUT_RDWR);
                        exit(1);
                }
                if (c == 0)
@@ -521,7 +521,7 @@ fail:
                                        errno = 0;
                                        cc = read(pv[0], buf, sizeof(buf));
                                        if (cc <= 0) {
-                                               shutdown(s, 1+1);
+                                               shutdown(s, SHUT_RDWR);
                                                FD_CLR(pv[0], &readfrom);
                                        } else {
 #ifdef CRYPT
@@ -539,7 +539,7 @@ fail:
                                        errno = 0;
                                        cc = read(pv1[0], buf, sizeof(buf));
                                        if (cc <= 0) {
-                                               shutdown(pv1[0], 1+1);
+                                               shutdown(pv1[0], SHUT_RDWR);
                                                FD_CLR(pv1[0], &readfrom);
                                        } else {
                                                des_enc_write(STDOUT_FILENO,
@@ -554,7 +554,7 @@ fail:
                                            buf, sizeof(buf),
                                                schedule, &kdata->session);
                                        if (cc <= 0) {
-                                               shutdown(pv2[0], 1+1);
+                                               shutdown(pv2[0], SHUT_RDWR);
                                                FD_CLR(pv2[0], &writeto);
                                        } else {
                                                write(pv2[0], buf, cc);
index 98b17fa..60cb0de 100644 (file)
@@ -32,7 +32,7 @@
  *
  * @(#)sys_term.c      8.4+1 (Berkeley) 5/30/95
  * $FreeBSD: src/libexec/telnetd/sys_term.c,v 1.24.2.8 2002/06/17 02:48:06 jmallett Exp $
- * $DragonFly: src/libexec/telnetd/sys_term.c,v 1.3 2006/01/12 13:43:10 corecode Exp $
+ * $DragonFly: src/libexec/telnetd/sys_term.c,v 1.4 2007/05/18 17:05:12 dillon Exp $
  */
 
 #include <sys/types.h>
@@ -1187,6 +1187,6 @@ cleanup(int sig __unused)
        *p = 'p';
        (void)chmod(line, 0666);
        (void)chown(line, 0, 0);
-       (void) shutdown(net, 2);
+       (void) shutdown(net, SHUT_RDWR);
        _exit(1);
 }
index 8c1a3bc..923ffd4 100644 (file)
@@ -37,7 +37,7 @@
  * @(#)disklabel.c     1.2 (Symmetric) 11/28/85
  * @(#)disklabel.c      8.2 (Berkeley) 1/7/94
  * $FreeBSD: src/sbin/disklabel/disklabel.c,v 1.28.2.15 2003/01/24 16:18:16 des Exp $
- * $DragonFly: src/sbin/disklabel/disklabel.c,v 1.14 2007/05/17 23:53:40 dillon Exp $
+ * $DragonFly: src/sbin/disklabel/disklabel.c,v 1.15 2007/05/18 17:05:12 dillon Exp $
  */
 
 #include <sys/param.h>
@@ -47,6 +47,7 @@
 #define DKTYPENAMES
 #include <sys/disklabel.h>
 #include <sys/diskmbr.h>
+#include <disktab.h>
 
 #include <vfs/ufs/dinode.h>
 #include <vfs/ufs/fs.h>
@@ -105,6 +106,7 @@ void        Warning(const char *, ...) __printflike(1, 2);
 void   usage(void);
 int    checkoldboot(int, const char *);
 struct disklabel *getvirginlabel(void);
+struct disklabel *getdisklabelfromdisktab(const char *name);
 
 #define        DEFEDITOR       _PATH_VI
 #define        streq(a,b)      (strcmp(a,b) == 0)
@@ -352,37 +354,14 @@ makelabel(const char *type, const char *name, struct disklabel *lp)
        if (strcmp(type, "auto") == 0)
                dp = getvirginlabel();
        else
-               dp = getdiskbyname(type);
+               dp = getdisklabelfromdisktab(type);
        if (dp == NULL)
                errx(1, "%s: unknown disk type", type);
        *lp = *dp;
-#if NUMBOOT > 0
+
        /*
-        * Set bootstrap name(s).
-        * 1. If set from command line, use those,
-        * 2. otherwise, check if disktab specifies them (b0 or b1),
-        * 3. otherwise, makebootarea() will choose ones based on the name
-        *    of the disk special file. E.g. /dev/ra0 -> raboot, bootra
+        * NOTE: boot control files may no longer be specified in disktab.
         */
-       if (!xxboot && lp->d_boot0) {
-               if (*lp->d_boot0 != '/')
-                       sprintf(boot0, "%s/%s", _PATH_BOOTDIR, lp->d_boot0);
-               else
-                       strcpy(boot0, lp->d_boot0);
-               xxboot = boot0;
-       }
-#if NUMBOOT > 1
-       if (!bootxx && lp->d_boot1) {
-               if (*lp->d_boot1 != '/')
-                       sprintf(boot1, "%s/%s", _PATH_BOOTDIR, lp->d_boot1);
-               else
-                       strcpy(boot1, lp->d_boot1);
-               bootxx = boot1;
-       }
-#endif
-#endif
-       /* d_packname is union d_boot[01], so zero */
-       bzero(lp->d_packname, sizeof(lp->d_packname));
        if (name)
                strncpy(lp->d_packname, name, sizeof(lp->d_packname));
 }
@@ -1507,10 +1486,12 @@ checklabel(struct disklabel *lp)
  *
  * The device name must be given in its "canonical" form.
  */
+static struct disklabel dlab;
+
 struct disklabel *
 getvirginlabel(void)
 {
-       static struct disklabel dlab;
+       struct disklabel *dl = &dlab;
        char nambuf[BBSIZE];
        int f;
 
@@ -1528,17 +1509,56 @@ getvirginlabel(void)
         * Try to use the new get-virgin-label ioctl.  If it fails,
         * fallback to the old get-disdk-info ioctl.
         */
-       if (ioctl(f, DIOCGDVIRGIN, &dlab) < 0) {
-               if (ioctl(f, DIOCGDINFO, &dlab) < 0) {
+       if (ioctl(f, DIOCGDVIRGIN, dl) < 0) {
+               if (ioctl(f, DIOCGDINFO, dl) < 0) {
                        warn("ioctl DIOCGDINFO");
                        close(f);
                        return (NULL);
                }
        }
        close(f);
-       dlab.d_boot0 = NULL;
-       dlab.d_boot1 = NULL;
-       return (&dlab);
+       return (dl);
+}
+
+struct disklabel *
+getdisklabelfromdisktab(const char *name)
+{
+       struct disktab *dt;
+       struct disklabel *dl = &dlab;
+       int i;
+
+       if ((dt = getdisktabbyname(name)) == NULL)
+               return(NULL);
+       dl->d_magic = DISKMAGIC;
+       dl->d_type = dt->d_typeid;
+       dl->d_subtype = 0;
+       dl->d_secsize = dt->d_media_blksize;
+       dl->d_nsectors = dt->d_secpertrack;
+       dl->d_ntracks = dt->d_nheads;
+       dl->d_ncylinders = dt->d_ncylinders;
+       dl->d_secpercyl = dt->d_secpercyl;
+       dl->d_secperunit = dt->d_media_blocks;
+       dl->d_rpm = dt->d_rpm;
+       dl->d_interleave = dt->d_interleave;
+       dl->d_trackskew = dt->d_trackskew;
+       dl->d_cylskew = dt->d_cylskew;
+       dl->d_headswitch = dt->d_headswitch;
+       dl->d_trkseek = dt->d_trkseek;
+       dl->d_magic2 = DISKMAGIC;
+       dl->d_npartitions = dt->d_npartitions;
+       dl->d_bbsize = dt->d_bbsize;
+       dl->d_sbsize = dt->d_sbsize;
+       for (i = 0; i < dt->d_npartitions; ++i) {
+               struct partition *dlp = &dl->d_partitions[i];
+               struct dt_partition *dtp = &dt->d_partitions[i];
+
+               dlp->p_size     = dtp->p_size;
+               dlp->p_offset   = dtp->p_offset;
+               dlp->p_fsize    = dtp->p_fsize;
+               dlp->p_fstype   = dtp->p_fstype;
+               dlp->p_frag     = dtp->p_fsize;
+       }
+       return(dl);
 }
 
 /*
index be048b7..a00ab10 100644 (file)
@@ -37,7 +37,7 @@
  *     @(#)activate.c  8.3 (Berkeley) 4/28/95
  *
  * $FreeBSD: src/sbin/mount_portal/activate.c,v 1.7 1999/08/28 00:13:35 peter Exp $
- * $DragonFly: src/sbin/mount_portal/activate.c,v 1.5 2005/11/06 12:36:40 swildner Exp $
+ * $DragonFly: src/sbin/mount_portal/activate.c,v 1.6 2007/05/18 17:05:12 dillon Exp $
  */
 
 #include <errno.h>
@@ -144,7 +144,7 @@ send_reply(int so, int fd, int error)
 #endif
        sleep(1);       /*XXX*/
 #ifdef notdef
-       if (shutdown(so, 2) < 0)
+       if (shutdown(so, SHUT_RDWR) < 0)
                syslog(LOG_ERR, "shutdown: %s", strerror(errno));
 #endif
        /*
index 170fb70..d024384 100644 (file)
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/netncp/ncp_sock.c,v 1.2 1999/10/12 10:36:59 bp Exp $
- * $DragonFly: src/sys/netproto/ncp/ncp_sock.c,v 1.19 2007/05/13 22:25:42 swildner Exp $
+ * $DragonFly: src/sys/netproto/ncp/ncp_sock.c,v 1.20 2007/05/18 17:05:12 dillon Exp $
  *
  * Low level socket routines
  */
@@ -367,20 +367,20 @@ ncp_sock_disconnect(struct ncp_conn *conn) {
        if (conn->ncp_so) {
                so = conn->ncp_so;
                conn->ncp_so = (struct socket *)0;
-               soshutdown(so, 2);
+               soshutdown(so, SHUT_RDWR);
                soclose(so, FNONBLOCK);
        }
        if (conn->wdg_so) {
                so = conn->wdg_so;
                conn->wdg_so = (struct socket *)0;
-               soshutdown(so, 2);
+               soshutdown(so, SHUT_RDWR);
                soclose(so, FNONBLOCK);
        }
 #ifdef NCPBURST
        if (conn->bc_so) {
                so = conn->bc_so;
                conn->bc_so = (struct socket *)NULL;
-               soshutdown(so, 2);
+               soshutdown(so, SHUT_RDWR);
                soclose(so, FNONBLOCK);
        }
 #endif
index c80c7ae..8f178f9 100644 (file)
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/netsmb/smb_trantcp.c,v 1.3.2.1 2001/05/22 08:32:34 bp Exp $
- * $DragonFly: src/sys/netproto/smb/smb_trantcp.c,v 1.19 2007/04/22 01:13:16 dillon Exp $
+ * $DragonFly: src/sys/netproto/smb/smb_trantcp.c,v 1.20 2007/05/18 17:05:13 dillon Exp $
  */
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -553,7 +553,7 @@ smb_nbst_disconnect(struct smb_vc *vcp, struct thread *td)
        if ((so = nbp->nbp_tso) != NULL) {
                nbp->nbp_flags &= ~NBF_CONNECTED;
                nbp->nbp_tso = (struct socket *)NULL;
-               soshutdown(so, 2);
+               soshutdown(so, SHUT_RDWR);
                soclose(so, FNONBLOCK);
        }
        if (nbp->nbp_state != NBST_RETARGET) {
index b74d0f5..f0b09ae 100644 (file)
@@ -35,7 +35,7 @@
  *
  *     @(#)nfs_socket.c        8.5 (Berkeley) 3/30/95
  * $FreeBSD: src/sys/nfs/nfs_socket.c,v 1.60.2.6 2003/03/26 01:44:46 alfred Exp $
- * $DragonFly: src/sys/vfs/nfs/nfs_socket.c,v 1.44 2007/04/22 01:13:17 dillon Exp $
+ * $DragonFly: src/sys/vfs/nfs/nfs_socket.c,v 1.45 2007/05/18 17:05:13 dillon Exp $
  */
 
 /*
@@ -421,7 +421,7 @@ nfs_disconnect(struct nfsmount *nmp)
        if (nmp->nm_so) {
                so = nmp->nm_so;
                nmp->nm_so = (struct socket *)0;
-               soshutdown(so, 2);
+               soshutdown(so, SHUT_RDWR);
                soclose(so, FNONBLOCK);
        }
 }
index b0bce96..9ddb499 100644 (file)
@@ -35,7 +35,7 @@
  *
  *     @(#)nfs_syscalls.c      8.5 (Berkeley) 3/30/95
  * $FreeBSD: src/sys/nfs/nfs_syscalls.c,v 1.58.2.1 2000/11/26 02:30:06 dillon Exp $
- * $DragonFly: src/sys/vfs/nfs/nfs_syscalls.c,v 1.29 2007/04/22 01:13:17 dillon Exp $
+ * $DragonFly: src/sys/vfs/nfs/nfs_syscalls.c,v 1.30 2007/05/18 17:05:13 dillon Exp $
  */
 
 #include <sys/param.h>
@@ -722,7 +722,7 @@ nfsrv_zapsock(struct nfssvc_sock *slp)
                so->so_rcv.ssb_flags &= ~SSB_UPCALL;
                so->so_upcall = NULL;
                so->so_upcallarg = NULL;
-               soshutdown(so, 2);
+               soshutdown(so, SHUT_RDWR);
                closef(fp, NULL);
                if (slp->ns_nam)
                        FREE(slp->ns_nam, M_SONAME);
index 72f057e..a34c1ec 100644 (file)
@@ -36,7 +36,7 @@
  *     @(#)portal_vfsops.c     8.11 (Berkeley) 5/14/95
  *
  * $FreeBSD: src/sys/miscfs/portal/portal_vfsops.c,v 1.26.2.2 2001/07/26 20:37:16 iedowse Exp $
- * $DragonFly: src/sys/vfs/portal/portal_vfsops.c,v 1.23 2006/09/05 00:55:50 dillon Exp $
+ * $DragonFly: src/sys/vfs/portal/portal_vfsops.c,v 1.24 2007/05/18 17:05:13 dillon Exp $
  */
 
 /*
@@ -178,7 +178,8 @@ portal_unmount(struct mount *mp, int mntflags)
         * daemon to wake up, and then the accept will get ECONNABORTED
         * which it interprets as a request to go and bury itself.
         */
-       soshutdown((struct socket *) VFSTOPORTAL(mp)->pm_server->f_data, 2);
+       soshutdown((struct socket *) VFSTOPORTAL(mp)->pm_server->f_data,
+               SHUT_RDWR);
        /*
         * Discard reference to underlying file.  Must call closef because
         * this may be the last reference.
index 94435c0..37f31f2 100644 (file)
@@ -36,7 +36,7 @@
  *     @(#)portal_vnops.c      8.14 (Berkeley) 5/21/95
  *
  * $FreeBSD: src/sys/miscfs/portal/portal_vnops.c,v 1.38 1999/12/21 06:29:00 chris Exp $
- * $DragonFly: src/sys/vfs/portal/portal_vnops.c,v 1.36 2007/05/09 00:53:36 dillon Exp $
+ * $DragonFly: src/sys/vfs/portal/portal_vnops.c,v 1.37 2007/05/18 17:05:13 dillon Exp $
  */
 
 /*
@@ -428,7 +428,7 @@ bad:;
        }
 
        if (so) {
-               soshutdown(so, 2);
+               soshutdown(so, SHUT_RDWR);
                soclose(so, FNONBLOCK);
        }
        return (error);
index 44a9ba8..7080b0a 100644 (file)
@@ -33,7 +33,7 @@
  * @(#) Copyright (c) 1983, 1990, 1993, 1994 The Regents of the University of California.  All rights reserved.
  * @(#)rsh.c   8.3 (Berkeley) 4/6/94
  * $FreeBSD: src/usr.bin/rsh/rsh.c,v 1.21.2.4 2002/09/17 15:34:41 nectar Exp $
- * $DragonFly: src/usr.bin/rsh/rsh.c,v 1.6 2005/01/01 22:00:15 cpressey Exp $
+ * $DragonFly: src/usr.bin/rsh/rsh.c,v 1.7 2007/05/18 17:05:12 dillon Exp $
  */
 
 #include <sys/param.h>
@@ -315,7 +315,7 @@ try_connect:
                        err(1, "fork");
        }
         else
-               shutdown(rem, 1);
+               shutdown(rem, SHUT_WR);
 
 #ifdef KERBEROS
 #ifdef CRYPT
@@ -383,7 +383,7 @@ rewrite:
                        goto reread;
                goto rewrite;
 done:
-               shutdown(rem, 1);
+               shutdown(rem, SHUT_WR);
                exit(0);
        }
 
index ca6bbae..c6eafbc 100644 (file)
@@ -32,7 +32,7 @@
  *
  * @(#)commands.c      8.4 (Berkeley) 5/30/95
  * $FreeBSD: src/usr.bin/telnet/commands.c,v 1.21.2.6 2002/11/30 05:35:13 eric Exp $
- * $DragonFly: src/usr.bin/telnet/commands.c,v 1.5 2007/05/17 08:19:02 swildner Exp $
+ * $DragonFly: src/usr.bin/telnet/commands.c,v 1.6 2007/05/18 17:05:12 dillon Exp $
  */
 
 #include <sys/param.h>
@@ -1338,7 +1338,7 @@ bye(int argc, char *argv[])
     extern int resettermname;
 
     if (connected) {
-       (void) shutdown(net, 2);
+       (void) shutdown(net, SHUT_RDWR);
        printf("Connection closed.\n");
        (void) NetClose(net);
        connected = 0;
index 7672975..5577d4b 100644 (file)
@@ -36,7 +36,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/usr.sbin/IPXrouted/main.c,v 1.10 1999/08/28 01:15:03 peter Exp $
- * $DragonFly: src/usr.sbin/IPXrouted/main.c,v 1.3 2004/03/11 09:38:59 hmp Exp $
+ * $DragonFly: src/usr.sbin/IPXrouted/main.c,v 1.4 2007/05/18 17:05:12 dillon Exp $
  *
  * @(#) Copyright (c) 1985, 1993 The Regents of the University of California.  All rights reserved.
  * @(#)main.c  8.1 (Berkeley) 6/5/93
@@ -166,7 +166,7 @@ main(int argc, char *argv[])
        r = socket(AF_ROUTE, SOCK_RAW, 0);
        /* later, get smart about lookingforinterfaces */
        if (r)
-               shutdown(r, 0); /* for now, don't want reponses */
+               shutdown(r, SHUT_RD); /* for now, don't want reponses */
        else {
                fprintf(stderr, "IPXrouted: no routing socket\n");
                exit(1);
index 405d382..1408788 100644 (file)
@@ -29,7 +29,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/usr.sbin/faithd/rsh.c,v 1.2.2.4 2002/04/28 05:40:29 suz Exp $
- * $DragonFly: src/usr.sbin/faithd/rsh.c,v 1.2 2003/06/17 04:29:53 dillon Exp $
+ * $DragonFly: src/usr.sbin/faithd/rsh.c,v 1.3 2007/05/18 17:05:12 dillon Exp $
  */
 
 #include <sys/param.h>
@@ -107,7 +107,7 @@ relay(int src, int dst)
        case 0:
                if (s_rcv == src) {
                        /* half close */
-                       shutdown(dst, 1);
+                       shutdown(dst, SHUT_WR);
                        half = YES;
                        break;
                }
index d655d69..5ace5ff 100644 (file)
@@ -29,7 +29,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/usr.sbin/faithd/tcp.c,v 1.1.2.3 2002/04/28 05:40:29 suz Exp $
- * $DragonFly: src/usr.sbin/faithd/tcp.c,v 1.4 2003/11/16 14:10:45 eirikn Exp $
+ * $DragonFly: src/usr.sbin/faithd/tcp.c,v 1.5 2007/05/18 17:05:12 dillon Exp $
  */
 
 #include <sys/param.h>
@@ -256,7 +256,7 @@ relay(int s_rcv, int s_snd, const char *service, int direction)
                                /* NOTREACHED */
                        case 0:
                                /* to close opposite-direction relay process */
-                               shutdown(s_snd, 0);
+                               shutdown(s_snd, SHUT_RD);
 
                                close(s_rcv);
                                close(s_snd);
index d058200..daf5f51 100644 (file)
@@ -29,7 +29,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/usr.sbin/rtsold/probe.c,v 1.2.2.3 2001/07/03 11:02:16 ume Exp $
- * $DragonFly: src/usr.sbin/rtsold/probe.c,v 1.7 2006/08/03 16:40:49 swildner Exp $
+ * $DragonFly: src/usr.sbin/rtsold/probe.c,v 1.8 2007/05/18 17:05:12 dillon Exp $
  */
 
 #include <sys/param.h>
@@ -84,7 +84,7 @@ probe_init(void)
        }
 
        /* make the socket send-only */
-       if (shutdown(probesock, 0)) {
+       if (shutdown(probesock, SHUT_RD)) {
                warnmsg(LOG_ERR, __func__, "shutdown: %s", strerror(errno));
                return(-1);
        }