aboutsummaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-10-14 02:23:43 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-10-14 02:23:43 +0000
commitea62077b850076c4d7dc3cf78ebd1888928c6ddf (patch)
tree37b7584ae40b99edb5583fbc4392b62ffdadf278 /miscutils
parent88ca06769028e442bf873b270c176ca0e9f021f8 (diff)
downloadbusybox-ea62077b850076c4d7dc3cf78ebd1888928c6ddf.tar.gz
add open_read_close() and similar stuff
Diffstat (limited to 'miscutils')
-rw-r--r--miscutils/crond.c4
-rw-r--r--miscutils/crontab.c2
-rw-r--r--miscutils/makedevs.c4
-rw-r--r--miscutils/nmeter.c14
4 files changed, 8 insertions, 16 deletions
diff --git a/miscutils/crond.c b/miscutils/crond.c
index 623e8c359..eaed1ea69 100644
--- a/miscutils/crond.c
+++ b/miscutils/crond.c
@@ -120,7 +120,7 @@ static void crondlog(const char *ctl, ...)
close(logfd);
#if ENABLE_DEBUG_CROND_OPTION
} else {
- bb_perror_msg("Can't open log file");
+ bb_perror_msg("can't open log file");
#endif
}
}
@@ -924,7 +924,7 @@ static void RunJob(const char *user, CronLine * line)
line->cl_MailFlag = 1;
fdprintf(mailFd, "To: %s\nSubject: cron: %s\n\n", user,
line->cl_Shell);
- line->cl_MailPos = lseek(mailFd, 0, 1);
+ line->cl_MailPos = lseek(mailFd, 0, SEEK_CUR);
} else {
crondlog("\024unable to create mail file user %s file %s, output to /dev/null\n", user, mailFile);
}
diff --git a/miscutils/crontab.c b/miscutils/crontab.c
index a3bfd495d..6ae1b020c 100644
--- a/miscutils/crontab.c
+++ b/miscutils/crontab.c
@@ -171,7 +171,7 @@ int crontab_main(int ac, char **av)
}
EditFile(caller, tmp);
remove(tmp);
- lseek(fd, 0L, 0);
+ lseek(fd, 0L, SEEK_SET);
repFd = fd;
}
option = REPLACE;
diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c
index e4658010c..6ff5cc223 100644
--- a/miscutils/makedevs.c
+++ b/miscutils/makedevs.c
@@ -187,7 +187,7 @@ int makedevs_main(int argc, char **argv)
sprintf(full_name_inc, "%s%d", full_name, i);
rdev = (major << 8) + minor + (i * increment - start);
if (mknod(full_name_inc, mode, rdev) == -1) {
- bb_perror_msg("line %d: could not create node %s", linenum, full_name_inc);
+ bb_perror_msg("line %d: cannot create node %s", linenum, full_name_inc);
ret = EXIT_FAILURE;
}
else if (chown(full_name_inc, uid, gid) == -1) {
@@ -203,7 +203,7 @@ int makedevs_main(int argc, char **argv)
} else {
rdev = (major << 8) + minor;
if (mknod(full_name, mode, rdev) == -1) {
- bb_perror_msg("line %d: could not create node %s", linenum, full_name);
+ bb_perror_msg("line %d: cannot create node %s", linenum, full_name);
ret = EXIT_FAILURE;
}
else if (chown(full_name, uid, gid) == -1) {
diff --git a/miscutils/nmeter.c b/miscutils/nmeter.c
index e83de38ec..d71bd6add 100644
--- a/miscutils/nmeter.c
+++ b/miscutils/nmeter.c
@@ -88,12 +88,7 @@ static void put_question_marks(int count)
static int readfile_z(char *buf, int sz, const char* fname)
{
- int fd;
- fd = xopen(fname, O_RDONLY);
- // We are not checking for short reads (valid only because
- // we are reading /proc files)
- sz = read(fd, buf, sz-1);
- close(fd);
+ sz = open_read_close(fname, buf, sz-1);
if (sz < 0) {
buf[0] = '\0';
return 1;
@@ -776,15 +771,12 @@ int nmeter_main(int argc, char* argv[])
s_stat *last = NULL;
s_stat *s;
char *cur, *prev;
- int fd;
if (argc != 2)
bb_show_usage();
- fd = xopen("/proc/version", O_RDONLY);
- if (read(fd, buf, sizeof(buf)) > 0)
- is26 = (strstr(buf, "Linux version 2.4.")==NULL);
- close(fd);
+ if (open_read_close("/proc/version", buf, sizeof(buf)) > 0)
+ is26 = (strstr(buf, " 2.4.")==NULL);
// Can use argv[1] directly, but this will mess up
// parameters as seen by e.g. ps. Making a copy...