Add casts to get rid of compiler warning about signed/unsigned issues.
This commit is contained in:
parent
8caa4e87f5
commit
6d894fd45b
@ -7,6 +7,7 @@ sysvinit (2.88dsf) UNRELEASED; urgency=low
|
|||||||
before files are copied into them.
|
before files are copied into them.
|
||||||
* Fix minor bug in optimizing of argument parsing. Based on
|
* Fix minor bug in optimizing of argument parsing. Based on
|
||||||
report from jakemus on freshmeat.
|
report from jakemus on freshmeat.
|
||||||
|
* Add casts to get rid of compiler warning about signed/unsigned issues.
|
||||||
|
|
||||||
-- Petter Reinholdtsen <pere@hungry.com> Sun, 12 Jul 2009 19:58:10 +0200
|
-- Petter Reinholdtsen <pere@hungry.com> Sun, 12 Jul 2009 19:58:10 +0200
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ int findtty(char *res, int rlen, dev_t dev)
|
|||||||
fprintf(stderr, "bootlogd: cannot find console device "
|
fprintf(stderr, "bootlogd: cannot find console device "
|
||||||
"%d:%d in /dev\n", major(dev), minor(dev));
|
"%d:%d in /dev\n", major(dev), minor(dev));
|
||||||
r = -1;
|
r = -1;
|
||||||
} else if (strlen(ent->d_name) + 5 >= rlen) {
|
} else if ((int)strlen(ent->d_name) + 5 >= rlen) {
|
||||||
fprintf(stderr, "bootlogd: console device name too long\n");
|
fprintf(stderr, "bootlogd: console device name too long\n");
|
||||||
r = -1;
|
r = -1;
|
||||||
} else
|
} else
|
||||||
@ -351,7 +351,7 @@ void writelog(FILE *fp, unsigned char *ptr, int len)
|
|||||||
break;
|
break;
|
||||||
case '\t':
|
case '\t':
|
||||||
line.pos += (line.pos / 8 + 1) * 8;
|
line.pos += (line.pos / 8 + 1) * 8;
|
||||||
if (line.pos >= sizeof(line.buf))
|
if (line.pos >= (int)sizeof(line.buf))
|
||||||
line.pos = sizeof(line.buf) - 1;
|
line.pos = sizeof(line.buf) - 1;
|
||||||
break;
|
break;
|
||||||
case 32 ... 127:
|
case 32 ... 127:
|
||||||
@ -367,7 +367,7 @@ void writelog(FILE *fp, unsigned char *ptr, int len)
|
|||||||
len--;
|
len--;
|
||||||
|
|
||||||
tlen = strlen(tmp);
|
tlen = strlen(tmp);
|
||||||
if (tlen && (line.pos + tlen < sizeof(line.buf))) {
|
if (tlen && (line.pos + tlen < (int)sizeof(line.buf))) {
|
||||||
memcpy(line.buf + line.pos, tmp, tlen);
|
memcpy(line.buf + line.pos, tmp, tlen);
|
||||||
line.pos += tlen;
|
line.pos += tlen;
|
||||||
}
|
}
|
||||||
@ -640,7 +640,7 @@ int main(int argc, char **argv)
|
|||||||
else
|
else
|
||||||
todo = endptr - outptr;
|
todo = endptr - outptr;
|
||||||
if (fp && todo)
|
if (fp && todo)
|
||||||
writelog(fp, outptr, todo);
|
writelog(fp, (unsigned char *)outptr, todo);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fp) {
|
if (fp) {
|
||||||
|
12
src/hddown.c
12
src/hddown.c
@ -111,11 +111,11 @@ static char *list_disks(DIR* blk, unsigned int* flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = snprintf(buf, sizeof(buf), SYS_BLK "/%s/device", d->d_name);
|
ret = snprintf(buf, sizeof(buf), SYS_BLK "/%s/device", d->d_name);
|
||||||
if ((ret >= sizeof(buf)) || (ret < 0))
|
if ((ret >= (int)sizeof(buf)) || (ret < 0))
|
||||||
goto empty; /* error */
|
goto empty; /* error */
|
||||||
|
|
||||||
ret = readlink(buf, lnk, sizeof(lnk));
|
ret = readlink(buf, lnk, sizeof(lnk));
|
||||||
if (ret >= sizeof(lnk))
|
if (ret >= (int)sizeof(lnk))
|
||||||
goto empty; /* error */
|
goto empty; /* error */
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (errno != ENOENT)
|
if (errno != ENOENT)
|
||||||
@ -129,7 +129,7 @@ static char *list_disks(DIR* blk, unsigned int* flags)
|
|||||||
continue; /* should not happen */
|
continue; /* should not happen */
|
||||||
|
|
||||||
ret = snprintf(buf, sizeof(buf), SYS_CLASS "/%s/manage_start_stop", ptr);
|
ret = snprintf(buf, sizeof(buf), SYS_CLASS "/%s/manage_start_stop", ptr);
|
||||||
if ((ret >= sizeof(buf)) || (ret < 0))
|
if ((ret >= (int)sizeof(buf)) || (ret < 0))
|
||||||
goto empty; /* error */
|
goto empty; /* error */
|
||||||
|
|
||||||
ret = stat(buf, &st);
|
ret = stat(buf, &st);
|
||||||
@ -200,7 +200,7 @@ static int do_standby_idedisk(char *device, unsigned int flags)
|
|||||||
int fd, ret;
|
int fd, ret;
|
||||||
|
|
||||||
ret = snprintf(buf, sizeof(buf), DEV_BASE "/%s", device);
|
ret = snprintf(buf, sizeof(buf), DEV_BASE "/%s", device);
|
||||||
if ((ret >= sizeof(buf)) || (ret < 0))
|
if ((ret >= (int)sizeof(buf)) || (ret < 0))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ((fd = open(buf, O_RDWR)) < 0)
|
if ((fd = open(buf, O_RDWR)) < 0)
|
||||||
@ -271,7 +271,7 @@ static FILE *hdopen(const char* const format, const char* const name)
|
|||||||
int fd, ret;
|
int fd, ret;
|
||||||
|
|
||||||
ret = snprintf(buf, sizeof(buf), format, name);
|
ret = snprintf(buf, sizeof(buf), format, name);
|
||||||
if ((ret >= sizeof(buf)) || (ret < 0))
|
if ((ret >= (int)sizeof(buf)) || (ret < 0))
|
||||||
goto error; /* error */
|
goto error; /* error */
|
||||||
|
|
||||||
fd = open(buf, O_RDONLY|O_NOCTTY);
|
fd = open(buf, O_RDONLY|O_NOCTTY);
|
||||||
@ -324,7 +324,7 @@ static int flush_cache_ext(const char *device)
|
|||||||
goto out; /* small disk */
|
goto out; /* small disk */
|
||||||
|
|
||||||
ret = snprintf(buf, sizeof(buf), DEV_BASE "/%s", device);
|
ret = snprintf(buf, sizeof(buf), DEV_BASE "/%s", device);
|
||||||
if ((ret >= sizeof(buf)) || (ret < 0))
|
if ((ret >= (int)sizeof(buf)) || (ret < 0))
|
||||||
return -1; /* error */
|
return -1; /* error */
|
||||||
|
|
||||||
if ((fd = open(buf, O_RDONLY|O_NONBLOCK)) < 0)
|
if ((fd = open(buf, O_RDONLY|O_NONBLOCK)) < 0)
|
||||||
|
@ -1254,7 +1254,7 @@ void read_inittab(void)
|
|||||||
strncpy(ch->id, id, sizeof(utproto.ut_id) + 1); /* Hack for different libs. */
|
strncpy(ch->id, id, sizeof(utproto.ut_id) + 1); /* Hack for different libs. */
|
||||||
strncpy(ch->process, process, sizeof(ch->process) - 1);
|
strncpy(ch->process, process, sizeof(ch->process) - 1);
|
||||||
if (rlevel[0]) {
|
if (rlevel[0]) {
|
||||||
for(f = 0; f < sizeof(rlevel) - 1 && rlevel[f]; f++) {
|
for(f = 0; f < (int)sizeof(rlevel) - 1 && rlevel[f]; f++) {
|
||||||
ch->rlevel[f] = rlevel[f];
|
ch->rlevel[f] = rlevel[f];
|
||||||
if (ch->rlevel[f] == 's') ch->rlevel[f] = 'S';
|
if (ch->rlevel[f] == 's') ch->rlevel[f] = 'S';
|
||||||
}
|
}
|
||||||
|
@ -331,7 +331,7 @@ int dns_lookup(char *result, int size, int useip, int32_t *a)
|
|||||||
*
|
*
|
||||||
* Ugly.
|
* Ugly.
|
||||||
*/
|
*/
|
||||||
if (a[0] == 0 && a[1] == 0 && a[2] == htonl (0xffff))
|
if (a[0] == 0 && a[1] == 0 && a[2] == (int32_t)htonl (0xffff))
|
||||||
mapped = 1;
|
mapped = 1;
|
||||||
topnibble = ntohl((unsigned int)a[0]) >> 28;
|
topnibble = ntohl((unsigned int)a[0]) >> 28;
|
||||||
|
|
||||||
@ -462,7 +462,7 @@ int list(struct utmp *p, time_t t, int what)
|
|||||||
r = dns_lookup(domain, sizeof(domain), useip, p->ut_addr_v6);
|
r = dns_lookup(domain, sizeof(domain), useip, p->ut_addr_v6);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
len = UT_HOSTSIZE;
|
len = UT_HOSTSIZE;
|
||||||
if (len >= sizeof(domain)) len = sizeof(domain) - 1;
|
if (len >= (int)sizeof(domain)) len = sizeof(domain) - 1;
|
||||||
domain[0] = 0;
|
domain[0] = 0;
|
||||||
strncat(domain, p->ut_host, len);
|
strncat(domain, p->ut_host, len);
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ int init_setenv(char *name, char *value)
|
|||||||
nl = strlen(name);
|
nl = strlen(name);
|
||||||
vl = value ? strlen(value) : 0;
|
vl = value ? strlen(value) : 0;
|
||||||
|
|
||||||
if (nl + vl + 3 >= sizeof(request.i.data))
|
if (nl + vl + 3 >= (int)sizeof(request.i.data))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
memcpy(request.i.data, name, nl);
|
memcpy(request.i.data, name, nl);
|
||||||
|
@ -298,7 +298,7 @@ char *getpasswd(char *crypted)
|
|||||||
if (read(0, pass, sizeof(pass) - 1) <= 0)
|
if (read(0, pass, sizeof(pass) - 1) <= 0)
|
||||||
ret = NULL;
|
ret = NULL;
|
||||||
else {
|
else {
|
||||||
for(i = 0; i < sizeof(pass) && pass[i]; i++)
|
for(i = 0; i < (int)sizeof(pass) && pass[i]; i++)
|
||||||
if (pass[i] == '\r' || pass[i] == '\n') {
|
if (pass[i] == '\r' || pass[i] == '\n') {
|
||||||
pass[i] = 0;
|
pass[i] = 0;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user