summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
Diffstat (limited to 'libbb')
-rw-r--r--libbb/fgets_str.c8
-rw-r--r--libbb/procps.c3
-rw-r--r--libbb/xfuncs.c3
3 files changed, 9 insertions, 5 deletions
diff --git a/libbb/fgets_str.c b/libbb/fgets_str.c
index 8f06fa5..41370d1 100644
--- a/libbb/fgets_str.c
+++ b/libbb/fgets_str.c
@@ -44,12 +44,14 @@ char *fgets_str(FILE *file, const char *terminating_string)
/* Check for terminating string */
end_string_offset = idx - term_length;
- if ((end_string_offset > 0) && (memcmp(&linebuf[end_string_offset], terminating_string, term_length) == 0)) {
+ if (end_string_offset > 0
+ && memcmp(&linebuf[end_string_offset], terminating_string, term_length) == 0
+ ) {
idx -= term_length;
break;
}
}
+ linebuf = xrealloc(linebuf, idx + 1);
linebuf[idx] = '\0';
- return(linebuf);
+ return linebuf;
}
-
diff --git a/libbb/procps.c b/libbb/procps.c
index 8fd5c1f..2bcd2cc 100644
--- a/libbb/procps.c
+++ b/libbb/procps.c
@@ -54,7 +54,8 @@ procps_status_t * procps_scan(int save_user_arg0)
dir = xopendir("/proc");
}
for (;;) {
- if ((entry = readdir(dir)) == NULL) {
+ entry = readdir(dir);
+ if (entry == NULL) {
closedir(dir);
dir = 0;
return 0;
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index 8428110..d22cd27 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -137,7 +137,8 @@ void xwrite(int fd, void *buf, size_t count)
// Die with an error message if we can't lseek to the right spot.
void xlseek(int fd, off_t offset, int whence)
{
- if (offset != lseek(fd, offset, whence)) bb_error_msg_and_die("lseek");
+ if (offset != lseek(fd, offset, whence))
+ bb_error_msg_and_die("lseek");
}
// Die with an error message if we can't read one character.