Fix warn_unused_result on write/read in nbd and ublk
This commit is contained in:
@@ -912,7 +912,7 @@ protected:
|
|||||||
int r, nbd = open(path, O_RDWR), qd_fd;
|
int r, nbd = open(path, O_RDWR), qd_fd;
|
||||||
if (nbd < 0)
|
if (nbd < 0)
|
||||||
{
|
{
|
||||||
write(notifyfd[1], &errno, sizeof(errno));
|
(void)write(notifyfd[1], &errno, sizeof(errno));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
r = ioctl(nbd, NBD_SET_SOCK, sockfd[1]);
|
r = ioctl(nbd, NBD_SET_SOCK, sockfd[1]);
|
||||||
@@ -954,7 +954,7 @@ protected:
|
|||||||
close(qd_fd);
|
close(qd_fd);
|
||||||
// Notify parent
|
// Notify parent
|
||||||
errno = 0;
|
errno = 0;
|
||||||
write(notifyfd[1], &errno, sizeof(errno));
|
(void)write(notifyfd[1], &errno, sizeof(errno));
|
||||||
close(notifyfd[1]);
|
close(notifyfd[1]);
|
||||||
close(sockfd[0]);
|
close(sockfd[0]);
|
||||||
if (bg)
|
if (bg)
|
||||||
@@ -971,11 +971,11 @@ protected:
|
|||||||
ioctl(nbd, NBD_CLEAR_SOCK);
|
ioctl(nbd, NBD_CLEAR_SOCK);
|
||||||
exit(0);
|
exit(0);
|
||||||
end_close:
|
end_close:
|
||||||
write(notifyfd[1], &errno, sizeof(errno));
|
(void)write(notifyfd[1], &errno, sizeof(errno));
|
||||||
close(nbd);
|
close(nbd);
|
||||||
exit(2);
|
exit(2);
|
||||||
end_unmap:
|
end_unmap:
|
||||||
write(notifyfd[1], &errno, sizeof(errno));
|
(void)write(notifyfd[1], &errno, sizeof(errno));
|
||||||
ioctl(nbd, NBD_CLEAR_SOCK);
|
ioctl(nbd, NBD_CLEAR_SOCK);
|
||||||
close(nbd);
|
close(nbd);
|
||||||
exit(3);
|
exit(3);
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ help:
|
|||||||
{
|
{
|
||||||
daemonize_reopen_stdio();
|
daemonize_reopen_stdio();
|
||||||
int ok = 0;
|
int ok = 0;
|
||||||
write(notifyfd[1], &ok, sizeof(ok));
|
(void)write(notifyfd[1], &ok, sizeof(ok));
|
||||||
close(notifyfd[1]);
|
close(notifyfd[1]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -377,7 +377,7 @@ help:
|
|||||||
// Parent - check status
|
// Parent - check status
|
||||||
close(notifyfd[1]);
|
close(notifyfd[1]);
|
||||||
int child_errno = 1;
|
int child_errno = 1;
|
||||||
read(notifyfd[0], &child_errno, sizeof(child_errno));
|
(void)read(notifyfd[0], &child_errno, sizeof(child_errno));
|
||||||
if (!child_errno)
|
if (!child_errno)
|
||||||
printf("/dev/ublkb%d\n", ublk_dev.dev_id);
|
printf("/dev/ublkb%d\n", ublk_dev.dev_id);
|
||||||
exit(child_errno);
|
exit(child_errno);
|
||||||
|
|||||||
Reference in New Issue
Block a user