diff options
Diffstat (limited to 'miscutils')
-rw-r--r-- | miscutils/crontab.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/miscutils/crontab.c b/miscutils/crontab.c index 71037b7ee..b292535b1 100644 --- a/miscutils/crontab.c +++ b/miscutils/crontab.c | |||
@@ -70,18 +70,18 @@ static void edit_file(const struct passwd *pas, const char *file) | |||
70 | 70 | ||
71 | static int open_as_user(const struct passwd *pas, const char *file) | 71 | static int open_as_user(const struct passwd *pas, const char *file) |
72 | { | 72 | { |
73 | int filedes[2]; | 73 | struct fd_pair filedes; |
74 | pid_t pid; | 74 | pid_t pid; |
75 | char c; | 75 | char c; |
76 | 76 | ||
77 | xpipe(filedes); | 77 | xpiped_pair(filedes); |
78 | pid = vfork(); | 78 | pid = vfork(); |
79 | if (pid < 0) /* ERROR */ | 79 | if (pid < 0) /* ERROR */ |
80 | bb_perror_msg_and_die("vfork"); | 80 | bb_perror_msg_and_die("vfork"); |
81 | if (pid) { /* PARENT */ | 81 | if (pid) { /* PARENT */ |
82 | int n = safe_read(filedes[0], &c, 1); | 82 | int n = safe_read(filedes.rd, &c, 1); |
83 | close(filedes[0]); | 83 | close(filedes.rd); |
84 | close(filedes[1]); | 84 | close(filedes.wr); |
85 | if (n > 0) /* child says it can read */ | 85 | if (n > 0) /* child says it can read */ |
86 | return open(file, O_RDONLY); | 86 | return open(file, O_RDONLY); |
87 | return -1; | 87 | return -1; |
@@ -95,7 +95,7 @@ static int open_as_user(const struct passwd *pas, const char *file) | |||
95 | /* We just try to read one byte. If that works, file is readable | 95 | /* We just try to read one byte. If that works, file is readable |
96 | * under this user. We signal that by sending one byte to parent. */ | 96 | * under this user. We signal that by sending one byte to parent. */ |
97 | if (safe_read(xopen(file, O_RDONLY), &c, 1) == 1) | 97 | if (safe_read(xopen(file, O_RDONLY), &c, 1) == 1) |
98 | safe_write(filedes[1], &c, 1); /* "papa, I can read!" */ | 98 | safe_write(filedes.wr, &c, 1); /* "papa, I can read!" */ |
99 | _exit(0); | 99 | _exit(0); |
100 | } | 100 | } |
101 | 101 | ||