mirror of
git://git.suckless.org/ubase
synced 2024-12-23 23:22:47 +00:00
remove some signed / unsigned type warnings
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
This commit is contained in:
parent
96af28da60
commit
c5f17bd3dc
3
chvt.c
3
chvt.c
@ -28,7 +28,8 @@ usage(void)
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int n, i, fd;
|
||||
unsigned int n, i;
|
||||
int fd;
|
||||
char c;
|
||||
|
||||
if(argc!=2 || strspn(argv[1], "1234567890") != strlen(argv[1]))
|
||||
|
4
dmesg.c
4
dmesg.c
@ -84,6 +84,7 @@ dmesg_show(int fd, const void *buf, size_t n)
|
||||
int last = '\n';
|
||||
char newbuf[n], *q = newbuf;
|
||||
const char *p = buf;
|
||||
ssize_t r;
|
||||
size_t i;
|
||||
|
||||
memset(newbuf, 0, n);
|
||||
@ -97,7 +98,8 @@ dmesg_show(int fd, const void *buf, size_t n)
|
||||
}
|
||||
last = p[i++];
|
||||
}
|
||||
if (write(fd, newbuf, n) != n)
|
||||
r = write(fd, newbuf, n);
|
||||
if(r < 0 || (size_t)r != n)
|
||||
return -1;
|
||||
if (last != '\n')
|
||||
if (write(fd, "\n", 1) != 1)
|
||||
|
2
getty.c
2
getty.c
@ -27,7 +27,7 @@ main(int argc, char *argv[])
|
||||
struct sigaction sa;
|
||||
char term[128], logname[LOGIN_NAME_MAX], c;
|
||||
char hostname[HOST_NAME_MAX + 1];
|
||||
int i = 0;
|
||||
unsigned int i = 0;
|
||||
ssize_t n;
|
||||
|
||||
ARGBEGIN {
|
||||
|
15
insmod.c
15
insmod.c
@ -18,7 +18,7 @@ int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
char *buf = NULL, *opts = NULL;
|
||||
unsigned long blen, plen = 0;
|
||||
size_t blen, plen = 0;
|
||||
int i, fd;
|
||||
ssize_t n;
|
||||
struct stat sb;
|
||||
@ -36,12 +36,12 @@ main(int argc, char *argv[])
|
||||
eprintf("open %s:", argv[0]);
|
||||
if (fstat(fd, &sb) < 0)
|
||||
eprintf("stat %s:", argv[0]);
|
||||
buf = malloc(sb.st_size);
|
||||
if (!buf)
|
||||
eprintf("malloc:");
|
||||
blen = sb.st_size;
|
||||
if(!(buf = malloc(blen)))
|
||||
eprintf("malloc:");
|
||||
|
||||
if ((n = read(fd, buf, blen)) != blen)
|
||||
n = read(fd, buf, blen);
|
||||
if(n < 0 || (size_t)n != blen)
|
||||
eprintf("read:");
|
||||
|
||||
argc--;
|
||||
@ -51,9 +51,8 @@ main(int argc, char *argv[])
|
||||
plen += strlen(argv[i]);
|
||||
if (plen > 0) {
|
||||
plen += argc;
|
||||
opts = calloc(1, plen);
|
||||
if (!opts)
|
||||
eprintf("malloc:");
|
||||
if(!(opts = calloc(1, plen)))
|
||||
eprintf("calloc:");
|
||||
for (i = 0; i < argc; i++) {
|
||||
strcat(opts, argv[i]);
|
||||
if (i + 1 < argc)
|
||||
|
@ -51,7 +51,7 @@ parsestat(pid_t pid, struct procstat *ps)
|
||||
&ps->sid, &ps->tty_nr, &ps->tpgid, &ps->flags,
|
||||
&ps->minflt, &ps->cminflt, &ps->majflt, &ps->cmajflt,
|
||||
&ps->utime, &ps->stime);
|
||||
fscanf(fp, "%ld %ld %ld %ld %ld %ld %lld %lu %ld %ld",
|
||||
fscanf(fp, "%ld %ld %ld %ld %ld %ld %llu %lu %ld %ld",
|
||||
&ps->cutime, &ps->cstime, &ps->priority, &ps->nice,
|
||||
&ps->num_threads, &ps->itrealvalue, &ps->starttime,
|
||||
&ps->vsize, &ps->rss, &ps->rsslim);
|
||||
|
Loading…
Reference in New Issue
Block a user