aboutsummaryrefslogtreecommitdiff
path: root/miscutils/crontab.c
diff options
context:
space:
mode:
authormjn3 <mjn3@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-03-19 09:13:01 +0000
committermjn3 <mjn3@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-03-19 09:13:01 +0000
commite901c15d890dbbdce4c086963cb1513653fc46b5 (patch)
treea318d0f03aa076c74b576ea45dc543a5669e8e91 /miscutils/crontab.c
parent40758c00616c3b2c85d83eb4afdeb04b1f65c9f1 (diff)
downloadbusybox-w32-e901c15d890dbbdce4c086963cb1513653fc46b5.tar.gz
busybox-w32-e901c15d890dbbdce4c086963cb1513653fc46b5.tar.bz2
busybox-w32-e901c15d890dbbdce4c086963cb1513653fc46b5.zip
Major coreutils update.
git-svn-id: svn://busybox.net/trunk/busybox@6751 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'miscutils/crontab.c')
-rw-r--r--miscutils/crontab.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/miscutils/crontab.c b/miscutils/crontab.c
index 5bd7db6e5..c6c33ace9 100644
--- a/miscutils/crontab.c
+++ b/miscutils/crontab.c
@@ -61,7 +61,7 @@ crontab_main(int ac, char **av)
61 61
62 UserId = getuid(); 62 UserId = getuid();
63 if ((pas = getpwuid(UserId)) == NULL) 63 if ((pas = getpwuid(UserId)) == NULL)
64 perror_msg_and_die("getpwuid"); 64 bb_perror_msg_and_die("getpwuid");
65 65
66 strncpy(caller, pas->pw_name, sizeof(caller)); 66 strncpy(caller, pas->pw_name, sizeof(caller));
67 67
@@ -105,10 +105,10 @@ crontab_main(int ac, char **av)
105 if (pas) { 105 if (pas) {
106 UserId = pas->pw_uid; 106 UserId = pas->pw_uid;
107 } else { 107 } else {
108 error_msg_and_die("user %s unknown", av[i]); 108 bb_error_msg_and_die("user %s unknown", av[i]);
109 } 109 }
110 } else { 110 } else {
111 error_msg_and_die("only the superuser may specify a user"); 111 bb_error_msg_and_die("only the superuser may specify a user");
112 } 112 }
113 } 113 }
114 break; 114 break;
@@ -116,7 +116,7 @@ crontab_main(int ac, char **av)
116 if (getuid() == geteuid()) { 116 if (getuid() == geteuid()) {
117 CDir = (*ptr) ? ptr : av[++i]; 117 CDir = (*ptr) ? ptr : av[++i];
118 } else { 118 } else {
119 error_msg_and_die("-c option: superuser only"); 119 bb_error_msg_and_die("-c option: superuser only");
120 } 120 }
121 break; 121 break;
122 default: 122 default:
@@ -125,14 +125,14 @@ crontab_main(int ac, char **av)
125 } 125 }
126 } 126 }
127 if (i != ac || option == NONE) 127 if (i != ac || option == NONE)
128 show_usage(); 128 bb_show_usage();
129 129
130 /* 130 /*
131 * Get password entry 131 * Get password entry
132 */ 132 */
133 133
134 if ((pas = getpwuid(UserId)) == NULL) 134 if ((pas = getpwuid(UserId)) == NULL)
135 perror_msg_and_die("getpwuid"); 135 bb_perror_msg_and_die("getpwuid");
136 136
137 /* 137 /*
138 * If there is a replacement file, obtain a secure descriptor to it. 138 * If there is a replacement file, obtain a secure descriptor to it.
@@ -141,7 +141,7 @@ crontab_main(int ac, char **av)
141 if (repFile) { 141 if (repFile) {
142 repFd = GetReplaceStream(caller, repFile); 142 repFd = GetReplaceStream(caller, repFile);
143 if (repFd < 0) 143 if (repFd < 0)
144 error_msg_and_die("unable to read replacement file"); 144 bb_error_msg_and_die("unable to read replacement file");
145 } 145 }
146 146
147 /* 147 /*
@@ -149,7 +149,7 @@ crontab_main(int ac, char **av)
149 */ 149 */
150 150
151 if (chdir(CDir) < 0) 151 if (chdir(CDir) < 0)
152 perror_msg_and_die("cannot change dir to %s", CDir); 152 bb_perror_msg_and_die("cannot change dir to %s", CDir);
153 153
154 /* 154 /*
155 * Handle options as appropriate 155 * Handle options as appropriate
@@ -166,7 +166,7 @@ crontab_main(int ac, char **av)
166 fputs(buf, stdout); 166 fputs(buf, stdout);
167 fclose(fi); 167 fclose(fi);
168 } else { 168 } else {
169 error_msg("no crontab for %s", pas->pw_name); 169 bb_error_msg("no crontab for %s", pas->pw_name);
170 } 170 }
171 } 171 }
172 break; 172 break;
@@ -190,7 +190,7 @@ crontab_main(int ac, char **av)
190 lseek(fd, 0L, 0); 190 lseek(fd, 0L, 0);
191 repFd = fd; 191 repFd = fd;
192 } else { 192 } else {
193 error_msg_and_die("unable to create %s", tmp); 193 bb_error_msg_and_die("unable to create %s", tmp);
194 } 194 }
195 195
196 } 196 }
@@ -211,7 +211,7 @@ crontab_main(int ac, char **av)
211 close(fd); 211 close(fd);
212 rename(path, pas->pw_name); 212 rename(path, pas->pw_name);
213 } else { 213 } else {
214 error_msg("unable to create %s/%s", CDir, path); 214 bb_error_msg("unable to create %s/%s", CDir, path);
215 } 215 }
216 close(repFd); 216 close(repFd);
217 } 217 }
@@ -244,7 +244,7 @@ crontab_main(int ac, char **av)
244 /* loop */ 244 /* loop */
245 } 245 }
246 if (fo == NULL) { 246 if (fo == NULL) {
247 error_msg("unable to append to %s/%s", CDir, CRONUPDATE); 247 bb_error_msg("unable to append to %s/%s", CDir, CRONUPDATE);
248 } 248 }
249 } 249 }
250 return 0; 250 return 0;
@@ -291,7 +291,7 @@ GetReplaceStream(const char *user, const char *file)
291 291
292 fd = open(file, O_RDONLY); 292 fd = open(file, O_RDONLY);
293 if (fd < 0) { 293 if (fd < 0) {
294 error_msg("unable to open %s", file); 294 bb_error_msg("unable to open %s", file);
295 exit(0); 295 exit(0);
296 } 296 }
297 buf[0] = 0; 297 buf[0] = 0;
@@ -328,7 +328,7 @@ EditFile(const char *user, const char *file)
328 /* 328 /*
329 * PARENT - failure 329 * PARENT - failure
330 */ 330 */
331 perror_msg_and_die("fork"); 331 bb_perror_msg_and_die("fork");
332 } 332 }
333 wait4(pid, NULL, 0, NULL); 333 wait4(pid, NULL, 0, NULL);
334} 334}