cgi-io: iron out extra compiler warnings
Fixes following errors: main.c:458:37: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare] main.c:463:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare] main.c:518:35: error: comparison of integer expressions of different signedness: ‘ssize_t’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare] main.c:157:3: error: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Werror=unused-result] main.c:763:3: error: ignoring return value of ‘chdir’, declared with attribute warn_unused_result [-Werror=unused-result] Signed-off-by: Petr Štetiar <ynezz@true.cz>
This commit is contained in:
parent
4e7411a8d0
commit
bb6cdb804c
|
@ -8,7 +8,7 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=cgi-io
|
PKG_NAME:=cgi-io
|
||||||
PKG_RELEASE:=13
|
PKG_RELEASE:=14
|
||||||
|
|
||||||
PKG_LICENSE:=GPL-2.0-or-later
|
PKG_LICENSE:=GPL-2.0-or-later
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,7 @@ static char *
|
||||||
checksum(const char *applet, size_t sumlen, const char *file)
|
checksum(const char *applet, size_t sumlen, const char *file)
|
||||||
{
|
{
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
int r;
|
||||||
int fds[2];
|
int fds[2];
|
||||||
static char chksum[65];
|
static char chksum[65];
|
||||||
|
|
||||||
|
@ -154,10 +155,14 @@ checksum(const char *applet, size_t sumlen, const char *file)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
memset(chksum, 0, sizeof(chksum));
|
memset(chksum, 0, sizeof(chksum));
|
||||||
read(fds[0], chksum, sumlen);
|
r = read(fds[0], chksum, sumlen);
|
||||||
|
|
||||||
waitpid(pid, NULL, 0);
|
waitpid(pid, NULL, 0);
|
||||||
close(fds[0]);
|
close(fds[0]);
|
||||||
close(fds[1]);
|
close(fds[1]);
|
||||||
|
|
||||||
|
if (r < 0)
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return chksum;
|
return chksum;
|
||||||
|
@ -442,7 +447,7 @@ header_field(multipart_parser *p, const char *data, size_t len)
|
||||||
static int
|
static int
|
||||||
header_value(multipart_parser *p, const char *data, size_t len)
|
header_value(multipart_parser *p, const char *data, size_t len)
|
||||||
{
|
{
|
||||||
int i, j;
|
size_t i, j;
|
||||||
|
|
||||||
if (!st.is_content_disposition)
|
if (!st.is_content_disposition)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -500,6 +505,8 @@ data_begin_cb(multipart_parser *p)
|
||||||
static int
|
static int
|
||||||
data_cb(multipart_parser *p, const char *data, size_t len)
|
data_cb(multipart_parser *p, const char *data, size_t len)
|
||||||
{
|
{
|
||||||
|
int wlen = len;
|
||||||
|
|
||||||
switch (st.parttype)
|
switch (st.parttype)
|
||||||
{
|
{
|
||||||
case PART_SESSIONID:
|
case PART_SESSIONID:
|
||||||
|
@ -515,14 +522,14 @@ data_cb(multipart_parser *p, const char *data, size_t len)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PART_FILEDATA:
|
case PART_FILEDATA:
|
||||||
if (write(st.tempfd, data, len) != len)
|
if (write(st.tempfd, data, len) != wlen)
|
||||||
{
|
{
|
||||||
close(st.tempfd);
|
close(st.tempfd);
|
||||||
return response(false, "I/O failure while writing temporary file");
|
return response(false, "I/O failure while writing temporary file");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!st.filedata)
|
if (!st.filedata)
|
||||||
st.filedata = !!len;
|
st.filedata = !!wlen;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -734,6 +741,7 @@ main_backup(int argc, char **argv)
|
||||||
{
|
{
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
time_t now;
|
time_t now;
|
||||||
|
int r;
|
||||||
int len;
|
int len;
|
||||||
int status;
|
int status;
|
||||||
int fds[2];
|
int fds[2];
|
||||||
|
@ -760,7 +768,9 @@ main_backup(int argc, char **argv)
|
||||||
close(fds[0]);
|
close(fds[0]);
|
||||||
close(fds[1]);
|
close(fds[1]);
|
||||||
|
|
||||||
chdir("/");
|
r = chdir("/");
|
||||||
|
if (r < 0)
|
||||||
|
return failure(500, errno, "Failed chdir('/')");
|
||||||
|
|
||||||
execl("/sbin/sysupgrade", "/sbin/sysupgrade",
|
execl("/sbin/sysupgrade", "/sbin/sysupgrade",
|
||||||
"--create-backup", "-", NULL);
|
"--create-backup", "-", NULL);
|
||||||
|
|
Loading…
Reference in New Issue