Skip to content

Commit c9c92fe

Browse files
author
Margo
committed
Last minute tweaks for lecture.
1 parent a4adc6c commit c9c92fe

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

shell3/data.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
PARENTPARENTchildPARENTchildPARENTchildPARENTchildPARENTchildPARENTPARENTPARENTPARENTchildchildchildchildchild
1+
childchildchildchildchildchildchildchildchildchildRENTPARENT

shell3/own.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ int main(int argc, char *argv[]) {
1414
// We want the parent and child to each have their own file descriptor.
1515
// So, we will create the file in the parent and then close it; then
1616
// we'll open it after the fork.
17-
int fd = open("data.out", O_CREAT | O_WRONLY, 0644);
17+
int fd = open("data.out", O_CREAT | O_WRONLY | O_TRUNC, 0644);
1818
if (fd < 0)
1919
exit(1);
2020
close(fd);

shell3/share.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ int main(int argc, char *argv[]) {
1313

1414
// We want the parent and child to share the file descriptor
1515
// so we are going to open it BEFORE forking
16-
int fd = open("data.out", O_CREAT | O_WRONLY, 0644);
16+
int fd = open("data.out", O_CREAT | O_WRONLY | O_TRUNC, 0644);
1717
if (fd < 0)
1818
exit(1);
1919

0 commit comments

Comments
 (0)