mounttab.c (114601) | mounttab.c (194880) |
---|---|
1/* 2 * Copyright (c) 1999 Martin Blapp 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27 28#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 1999 Martin Blapp 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/usr.sbin/rpc.umntall/mounttab.c 114601 2003-05-03 21:06:42Z obrien $"); | 29__FBSDID("$FreeBSD: head/usr.sbin/rpc.umntall/mounttab.c 194880 2009-06-24 18:42:21Z dfr $"); |
30 31#include <sys/syslog.h> 32 33#include <rpc/rpc.h> | 30 31#include <sys/syslog.h> 32 33#include <rpc/rpc.h> |
34#include <nfs/rpcv2.h> | 34#include <rpcsvc/mount.h> |
35 36#include <err.h> 37#include <errno.h> 38#include <limits.h> 39#include <stdio.h> 40#include <stdlib.h> 41#include <string.h> 42#include <unistd.h> --- 72 unchanged lines hidden (view full) --- 115 } 116 time = ultmp; 117 if ((mtabp = malloc(sizeof (struct mtablist))) == NULL) { 118 syslog(LOG_ERR, "malloc"); 119 fclose(mtabfile); 120 return (0); 121 } 122 mtabp->mtab_time = time; | 35 36#include <err.h> 37#include <errno.h> 38#include <limits.h> 39#include <stdio.h> 40#include <stdlib.h> 41#include <string.h> 42#include <unistd.h> --- 72 unchanged lines hidden (view full) --- 115 } 116 time = ultmp; 117 if ((mtabp = malloc(sizeof (struct mtablist))) == NULL) { 118 syslog(LOG_ERR, "malloc"); 119 fclose(mtabfile); 120 return (0); 121 } 122 mtabp->mtab_time = time; |
123 memmove(mtabp->mtab_host, hostp, RPCMNT_NAMELEN); 124 mtabp->mtab_host[RPCMNT_NAMELEN - 1] = '\0'; 125 memmove(mtabp->mtab_dirp, dirp, RPCMNT_PATHLEN); 126 mtabp->mtab_dirp[RPCMNT_PATHLEN - 1] = '\0'; | 123 memmove(mtabp->mtab_host, hostp, MNTNAMLEN); 124 mtabp->mtab_host[MNTNAMLEN - 1] = '\0'; 125 memmove(mtabp->mtab_dirp, dirp, MNTPATHLEN); 126 mtabp->mtab_dirp[MNTPATHLEN - 1] = '\0'; |
127 mtabp->mtab_next = (struct mtablist *)NULL; 128 *mtabpp = mtabp; 129 mtabpp = &mtabp->mtab_next; 130 } 131 fclose(mtabfile); 132 return (1); 133} 134 --- 56 unchanged lines hidden (view full) --- 191 continue; 192 if (dirp != NULL && strcmp(mtabp->mtab_dirp, dirp) != 0) 193 continue; 194 195 if (verbose) 196 warnx("delete mounttab entry%s %s:%s", 197 (dirp == NULL) ? " by host" : "", 198 mtabp->mtab_host, mtabp->mtab_dirp); | 127 mtabp->mtab_next = (struct mtablist *)NULL; 128 *mtabpp = mtabp; 129 mtabpp = &mtabp->mtab_next; 130 } 131 fclose(mtabfile); 132 return (1); 133} 134 --- 56 unchanged lines hidden (view full) --- 191 continue; 192 if (dirp != NULL && strcmp(mtabp->mtab_dirp, dirp) != 0) 193 continue; 194 195 if (verbose) 196 warnx("delete mounttab entry%s %s:%s", 197 (dirp == NULL) ? " by host" : "", 198 mtabp->mtab_host, mtabp->mtab_dirp); |
199 bzero(mtabp->mtab_host, RPCMNT_NAMELEN); | 199 bzero(mtabp->mtab_host, MNTNAMLEN); |
200 } 201 free(host); 202} 203 204/* 205 * Free struct mtablist mtab. 206 */ 207void --- 17 unchanged lines hidden --- | 200 } 201 free(host); 202} 203 204/* 205 * Free struct mtablist mtab. 206 */ 207void --- 17 unchanged lines hidden --- |