Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make filemon_read: report error if lseek fails
details: https://anonhg.NetBSD.org/src/rev/c4d29a8b8763
branches: trunk
changeset: 973271:c4d29a8b8763
user: sjg <sjg%NetBSD.org@localhost>
date: Thu Jun 25 15:45:37 2020 +0000
description:
filemon_read: report error if lseek fails
Reviewed by: riastradh
diffstat:
usr.bin/make/meta.c | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diffs (35 lines):
diff -r f7e37777291a -r c4d29a8b8763 usr.bin/make/meta.c
--- a/usr.bin/make/meta.c Thu Jun 25 15:43:26 2020 +0000
+++ b/usr.bin/make/meta.c Thu Jun 25 15:45:37 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: meta.c,v 1.81 2020/04/03 03:32:28 sjg Exp $ */
+/* $NetBSD: meta.c,v 1.82 2020/06/25 15:45:37 sjg Exp $ */
/*
* Implement 'meta' mode.
@@ -170,14 +170,18 @@
return 0;
}
/* rewind */
- (void)lseek(fd, (off_t)0, SEEK_SET);
+ if (lseek(fd, (off_t)0, SEEK_SET) < 0) {
+ error = errno;
+ warn("Could not rewind filemon");
+ fprintf(mfp, "\n");
+ } else {
+ error = 0;
+ fprintf(mfp, "\n-- filemon acquired metadata --\n");
- error = 0;
- fprintf(mfp, "\n-- filemon acquired metadata --\n");
-
- while ((n = read(fd, buf, sizeof(buf))) > 0) {
- if ((int)fwrite(buf, 1, n, mfp) < n)
- error = EIO;
+ while ((n = read(fd, buf, sizeof(buf))) > 0) {
+ if ((int)fwrite(buf, 1, n, mfp) < n)
+ error = EIO;
+ }
}
fflush(mfp);
if (close(fd) < 0)
Home |
Main Index |
Thread Index |
Old Index