[hackers] [ubase] Bring back some C89/C90 elements || FRIGN
commit 5a2f3c85b7baf5c5d920b8579ad3178b26592366
Author: FRIGN <dev_AT_frign.de>
Date: Thu Jun 5 11:28:08 2014 +0100
Bring back some C89/C90 elements
dmesg: don't use VLAs
getty, su: no need to use compound literals
diff --git a/dmesg.c b/dmesg.c
index c60c503..b90d9ac 100644
--- a/dmesg.c
+++ b/dmesg.c
_AT_@ -80,12 +80,13 @@ static int
dmesg_show(int fd, const void *buf, size_t n)
{
int last = '
';
- char newbuf[n], *q = newbuf;
+ char *newbuf, *q;
const char *p = buf;
ssize_t r;
size_t i;
- memset(newbuf, 0, n);
+ newbuf = calloc(n, sizeof(char));
+ q = newbuf;
for (i = 0; i < n; ) {
if (last == '
' && p[i] == '<') {
i += 2;
_AT_@ -97,6 +98,7 @@ dmesg_show(int fd, const void *buf, size_t n)
last = p[i++];
}
r = write(fd, newbuf, n);
+ free(newbuf);
if(r < 0 || (size_t)r != n)
return -1;
if (last != '
')
diff --git a/getty.c b/getty.c
index 3a580ad..6c0af00 100644
--- a/getty.c
+++ b/getty.c
_AT_@ -109,5 +109,5 @@ main(int argc, char *argv[])
eprintf("login name cannot start with '-'
");
if (logname[0] == '
Received on Thu Jun 05 2014 - 12:33:38 CEST
This archive was generated by hypermail 2.3.0
: Thu Jun 05 2014 - 12:36:08 CEST