summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
Diffstat (limited to 'libbb')
-rw-r--r--libbb/Kbuild1
-rw-r--r--libbb/xfuncs.c12
2 files changed, 7 insertions, 6 deletions
diff --git a/libbb/Kbuild b/libbb/Kbuild
index ffded6a..a3b78ef 100644
--- a/libbb/Kbuild
+++ b/libbb/Kbuild
@@ -61,6 +61,7 @@ lib-y += perror_msg.o
lib-y += perror_msg_and_die.o
lib-y += perror_nomsg.o
lib-y += perror_nomsg_and_die.o
+lib-y += pidfile.o
lib-y += process_escape_sequence.o
lib-y += procps.o
lib-y += read.o
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index 7f870ac..e1632a4 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -257,7 +257,7 @@ void smart_ulltoa5(unsigned long long ul, char buf[5])
// truncated result is always null terminated (unless buflen is 0), and
// contains the first few digits of the result ala strncpy.
void BUG_sizeof_unsigned_not_4(void);
-void utoa_to_buf(unsigned n, char *buf, unsigned buflen)
+char *utoa_to_buf(unsigned n, char *buf, unsigned buflen)
{
unsigned i, out, res;
if (sizeof(unsigned) != 4)
@@ -273,19 +273,19 @@ void utoa_to_buf(unsigned n, char *buf, unsigned buflen)
*buf++ = '0' + res;
}
}
- *buf = '\0';
}
+ return buf;
}
// Convert signed integer to ascii, like utoa_to_buf()
-void itoa_to_buf(int n, char *buf, unsigned buflen)
+char *itoa_to_buf(int n, char *buf, unsigned buflen)
{
if (buflen && n<0) {
n = -n;
*buf++ = '-';
buflen--;
}
- utoa_to_buf((unsigned)n, buf, buflen);
+ return utoa_to_buf((unsigned)n, buf, buflen);
}
// The following two functions use a static buffer, so calling either one a
@@ -300,7 +300,7 @@ static char local_buf[12];
// Convert unsigned integer to ascii using a static buffer (returned).
char *utoa(unsigned n)
{
- utoa_to_buf(n, local_buf, sizeof(local_buf));
+ *(utoa_to_buf(n, local_buf, sizeof(local_buf))) = '\0';
return local_buf;
}
@@ -308,7 +308,7 @@ char *utoa(unsigned n)
// Convert signed integer to ascii using a static buffer (returned).
char *itoa(int n)
{
- itoa_to_buf(n, local_buf, sizeof(local_buf));
+ *(itoa_to_buf(n, local_buf, sizeof(local_buf))) = '\0';
return local_buf;
}