We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e8c978e commit 88e3baeCopy full SHA for 88e3bae
file-locking/fcntl-locking.c
@@ -145,6 +145,13 @@ dump_file(char *filename, bool locking)
145
if (locking)
146
lockr(fd, &fl);
147
148
+ /*
149
+ * The file size is not hard-coded here so that one can
150
+ * see the contents of the file before it is fully written.
151
+ * This can totally happen, the parent can get to calling
152
+ * dump_file() because any of the children finish the complete
153
+ * write.
154
+ */
155
(void) lseek(fd, SEEK_SET, 0);
156
memset(buf, 0, sizeof (buf));
157
n = read(fd, buf, sizeof (buf));
0 commit comments