summaryrefslogtreecommitdiff
path: root/libbb/xfuncs.c
diff options
context:
space:
mode:
authorDenis Vlasenko2006-10-11 20:59:02 +0000
committerDenis Vlasenko2006-10-11 20:59:02 +0000
commit1db39b2f51c2877ad4b5c0094f2e1f8d6449ca91 (patch)
treec3e9787a51628fbb2314ade4785d7a6d887686e1 /libbb/xfuncs.c
parent1114de7219f8e42d6d883c476a9458f637806365 (diff)
downloadbusybox-1db39b2f51c2877ad4b5c0094f2e1f8d6449ca91.zip
busybox-1db39b2f51c2877ad4b5c0094f2e1f8d6449ca91.tar.gz
nmeter: new applet. ~4k
Fix build proble on x86_64
Diffstat (limited to 'libbb/xfuncs.c')
-rw-r--r--libbb/xfuncs.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index de765a3..8428110 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -114,10 +114,9 @@ int xopen3(const char *pathname, int flags, int mode)
void xread(int fd, void *buf, size_t count)
{
while (count) {
- ssize_t size;
-
- if ((size = safe_read(fd, buf, count)) < 1)
- bb_error_msg_and_die("Short read");
+ ssize_t size = safe_read(fd, buf, count);
+ if (size < 1)
+ bb_error_msg_and_die("short read");
count -= size;
buf = ((char *) buf) + size;
}
@@ -127,10 +126,9 @@ void xread(int fd, void *buf, size_t count)
void xwrite(int fd, void *buf, size_t count)
{
while (count) {
- ssize_t size;
-
- if ((size = safe_write(fd, buf, count)) < 1)
- bb_error_msg_and_die("Short write");
+ ssize_t size = safe_write(fd, buf, count);
+ if (size < 1)
+ bb_error_msg_and_die("short write");
count -= size;
buf = ((char *) buf) + size;
}
@@ -149,7 +147,7 @@ unsigned char xread_char(int fd)
xread(fd, &tmp, 1);
- return(tmp);
+ return tmp;
}
// Die with supplied error message if this FILE * has ferror set.
@@ -220,7 +218,7 @@ int wait4pid(int pid)
void xsetenv(const char *key, const char *value)
{
- if(setenv(key, value, 1))
+ if (setenv(key, value, 1))
bb_error_msg_and_die(bb_msg_memory_exhausted);
}