Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

(patch) proper calls ftruncate(2) and lseek(2) in edquota(8)

From: Andrey Matveev <andrushock(at)korovino.net>
Date: Sun Apr 13 2003 - 20:35:13 EDT


Index: usr.sbin/edquota/edquota.c



RCS file: /cvs/src/usr.sbin/edquota/edquota.c,v retrieving revision 1.37
diff -u -r1.37 edquota.c
--- usr.sbin/edquota/edquota.c	2003/04/02 20:30:09	1.37
+++ usr.sbin/edquota/edquota.c	2003/04/13 23:07:59
@@ -432,8 +432,8 @@
 	struct quotause *qup;
 	FILE *fd;
 

- ftruncate(outfd, 0);
- lseek(outfd, 0, SEEK_SET);
+ ftruncate(outfd, (off_t)0); + lseek(outfd, (off_t)0, SEEK_SET); if ((fd = fdopen(dup(outfd), "w")) == NULL) err(1, "%s", tmpfil); (void)fprintf(fd, "Quotas for %s %s:\n", qfextension[quotatype], name); @@ -466,7 +466,7 @@ struct dqblk dqblk; char *fsp, line1[BUFSIZ], line2[BUFSIZ];
- lseek(infd, 0, SEEK_SET);
+ lseek(infd, (off_t)0, SEEK_SET); fd = fdopen(dup(infd), "r"); if (fd == NULL) { warnx("can't re-read temp file!!"); @@ -575,8 +575,8 @@ char *cvtstoa(); FILE *fd;
- ftruncate(outfd, 0);
- lseek(outfd, 0, SEEK_SET);
+ ftruncate(outfd, (off_t)0); + lseek(outfd, (off_t)0, SEEK_SET); if ((fd = fdopen(dup(outfd), "w")) == NULL) err(1, "%s", tmpfil); (void)fprintf(fd, @@ -609,7 +609,7 @@ time_t itime, btime, iseconds, bseconds; char *fsp, bunits[10], iunits[10], line1[BUFSIZ];
- lseek(infd, 0, SEEK_SET);
+ lseek(infd, (off_t)0, SEEK_SET); fd = fdopen(dup(infd), "r"); if (fd == NULL) { warnx("can't re-read temp file!!");
Received on Sun Apr 13 19:33:59 2003

This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 13:29:53 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library