mounttab.c (56038) | mounttab.c (66814) |
---|---|
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 --- 13 unchanged lines hidden (view full) --- 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#ifndef lint 29static const char rcsid[] = | 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 --- 13 unchanged lines hidden (view full) --- 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#ifndef lint 29static const char rcsid[] = |
30 "$FreeBSD: head/usr.sbin/rpc.umntall/mounttab.c 56038 2000-01-15 14:28:14Z green $"; | 30 "$FreeBSD: head/usr.sbin/rpc.umntall/mounttab.c 66814 2000-10-08 09:24:45Z bde $"; |
31#endif /* not lint */ 32 33#include <sys/syslog.h> 34 35#include <rpc/rpc.h> 36#include <nfs/rpcv2.h> 37 38#include <err.h> --- 16 unchanged lines hidden (view full) --- 55add_mtab(char *hostp, char *dirp) { 56 FILE *mtabfile; 57 time_t *now; 58 59 now = NULL; 60 if ((mtabfile = fopen(PATH_MOUNTTAB, "a")) == NULL) 61 return (0); 62 else { | 31#endif /* not lint */ 32 33#include <sys/syslog.h> 34 35#include <rpc/rpc.h> 36#include <nfs/rpcv2.h> 37 38#include <err.h> --- 16 unchanged lines hidden (view full) --- 55add_mtab(char *hostp, char *dirp) { 56 FILE *mtabfile; 57 time_t *now; 58 59 now = NULL; 60 if ((mtabfile = fopen(PATH_MOUNTTAB, "a")) == NULL) 61 return (0); 62 else { |
63 fprintf(mtabfile, "%ld\t%s\t%s\n", time(now), hostp, dirp); | 63 fprintf(mtabfile, "%ld\t%s\t%s\n", 64 (long)time(now), hostp, dirp); |
64 fclose(mtabfile); 65 return (1); 66 } 67} 68 69/* 70 * Read mounttab line for line and return struct mtablist. 71 */ --- 72 unchanged lines hidden (view full) --- 144 if ((mtabfile = fopen(PATH_MOUNTTAB, "w")) == NULL) { 145 syslog(LOG_ERR, "can't write to %s", PATH_MOUNTTAB); 146 return (0); 147 } 148 line = 0; 149 for (mtabp = mtabhead; mtabp != NULL; mtabp = mtabp->mtab_next) { 150 if (mtabp->mtab_host != NULL && 151 strlen(mtabp->mtab_host) > 0) { | 65 fclose(mtabfile); 66 return (1); 67 } 68} 69 70/* 71 * Read mounttab line for line and return struct mtablist. 72 */ --- 72 unchanged lines hidden (view full) --- 145 if ((mtabfile = fopen(PATH_MOUNTTAB, "w")) == NULL) { 146 syslog(LOG_ERR, "can't write to %s", PATH_MOUNTTAB); 147 return (0); 148 } 149 line = 0; 150 for (mtabp = mtabhead; mtabp != NULL; mtabp = mtabp->mtab_next) { 151 if (mtabp->mtab_host != NULL && 152 strlen(mtabp->mtab_host) > 0) { |
152 fprintf(mtabfile, "%ld\t%s\t%s\n", mtabp->mtab_time, 153 mtabp->mtab_host, mtabp->mtab_dirp); | 153 fprintf(mtabfile, "%ld\t%s\t%s\n", 154 (long)mtabp->mtab_time, mtabp->mtab_host, 155 mtabp->mtab_dirp); |
154 if (verbose) { 155 warnx("write entry " "%s:%s", 156 mtabp->mtab_host, mtabp->mtab_dirp); 157 } 158 clean_mtab(mtabp->mtab_host, mtabp->mtab_dirp); 159 line++; 160 } 161 } --- 65 unchanged lines hidden --- | 156 if (verbose) { 157 warnx("write entry " "%s:%s", 158 mtabp->mtab_host, mtabp->mtab_dirp); 159 } 160 clean_mtab(mtabp->mtab_host, mtabp->mtab_dirp); 161 line++; 162 } 163 } --- 65 unchanged lines hidden --- |