diff options
author | ache <ache@FreeBSD.org> | 1994-11-22 18:52:58 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1994-11-22 18:52:58 +0000 |
commit | 1c05db44749c5c34e5a0658b6293258ab94f8903 (patch) | |
tree | 411f988300b3092cdd4cbc4e9a634a9d934e88d4 /usr.sbin/edquota | |
parent | 4a8057be335a2441f022e10dd48fd2573ceb0422 (diff) | |
download | FreeBSD-src-1c05db44749c5c34e5a0658b6293258ab94f8903.zip FreeBSD-src-1c05db44749c5c34e5a0658b6293258ab94f8903.tar.gz |
Make edquota works with other then vi editors,
i.e.check file by name, not by fd
Diffstat (limited to 'usr.sbin/edquota')
-rw-r--r-- | usr.sbin/edquota/edquota.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/usr.sbin/edquota/edquota.c b/usr.sbin/edquota/edquota.c index 3646720..90bfb85 100644 --- a/usr.sbin/edquota/edquota.c +++ b/usr.sbin/edquota/edquota.c @@ -137,7 +137,7 @@ main(argc, argv) protoprivs = getprivs(0, quotatype); if (writetimes(protoprivs, tmpfd, quotatype) == 0) exit(1); - if (editit(tmpfil) && readtimes(protoprivs, tmpfd)) + if (editit(tmpfil) && readtimes(protoprivs, tmpfil)) putprivs(0, quotatype, protoprivs); freeprivs(protoprivs); exit(0); @@ -148,7 +148,7 @@ main(argc, argv) curprivs = getprivs(id, quotatype); if (writeprivs(curprivs, tmpfd, *argv, quotatype) == 0) continue; - if (editit(tmpfil) && readprivs(curprivs, tmpfd)) + if (editit(tmpfil) && readprivs(curprivs, tmpfil)) putprivs(id, quotatype, curprivs); freeprivs(curprivs); } @@ -396,9 +396,9 @@ writeprivs(quplist, outfd, name, quotatype) /* * Merge changes to an ASCII file into a quotause list. */ -readprivs(quplist, infd) +readprivs(quplist, inname) struct quotause *quplist; - int infd; + char *inname; { register struct quotause *qup; FILE *fd; @@ -407,8 +407,7 @@ readprivs(quplist, infd) struct dqblk dqblk; char *fsp, line1[BUFSIZ], line2[BUFSIZ]; - lseek(infd, 0, L_SET); - fd = fdopen(dup(infd), "r"); + fd = fopen(inname, "r"); if (fd == NULL) { fprintf(stderr, "Can't re-read temp file!!\n"); return (0); @@ -537,9 +536,9 @@ writetimes(quplist, outfd, quotatype) /* * Merge changes of grace times in an ASCII file into a quotause list. */ -readtimes(quplist, infd) +readtimes(quplist, inname) struct quotause *quplist; - int infd; + char *inname; { register struct quotause *qup; FILE *fd; @@ -548,8 +547,7 @@ readtimes(quplist, infd) time_t itime, btime, iseconds, bseconds; char *fsp, bunits[10], iunits[10], line1[BUFSIZ]; - lseek(infd, 0, L_SET); - fd = fdopen(dup(infd), "r"); + fd = fopen(inname, "r"); if (fd == NULL) { fprintf(stderr, "Can't re-read temp file!!\n"); return (0); |