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;
|
||||
if (nbd < 0)
|
||||
{
|
||||
write(notifyfd[1], &errno, sizeof(errno));
|
||||
(void)write(notifyfd[1], &errno, sizeof(errno));
|
||||
exit(1);
|
||||
}
|
||||
r = ioctl(nbd, NBD_SET_SOCK, sockfd[1]);
|
||||
@@ -954,7 +954,7 @@ protected:
|
||||
close(qd_fd);
|
||||
// Notify parent
|
||||
errno = 0;
|
||||
write(notifyfd[1], &errno, sizeof(errno));
|
||||
(void)write(notifyfd[1], &errno, sizeof(errno));
|
||||
close(notifyfd[1]);
|
||||
close(sockfd[0]);
|
||||
if (bg)
|
||||
@@ -971,11 +971,11 @@ protected:
|
||||
ioctl(nbd, NBD_CLEAR_SOCK);
|
||||
exit(0);
|
||||
end_close:
|
||||
write(notifyfd[1], &errno, sizeof(errno));
|
||||
(void)write(notifyfd[1], &errno, sizeof(errno));
|
||||
close(nbd);
|
||||
exit(2);
|
||||
end_unmap:
|
||||
write(notifyfd[1], &errno, sizeof(errno));
|
||||
(void)write(notifyfd[1], &errno, sizeof(errno));
|
||||
ioctl(nbd, NBD_CLEAR_SOCK);
|
||||
close(nbd);
|
||||
exit(3);
|
||||
|
||||
@@ -335,7 +335,7 @@ help:
|
||||
{
|
||||
daemonize_reopen_stdio();
|
||||
int ok = 0;
|
||||
write(notifyfd[1], &ok, sizeof(ok));
|
||||
(void)write(notifyfd[1], &ok, sizeof(ok));
|
||||
close(notifyfd[1]);
|
||||
}
|
||||
else
|
||||
@@ -377,7 +377,7 @@ help:
|
||||
// Parent - check status
|
||||
close(notifyfd[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)
|
||||
printf("/dev/ublkb%d\n", ublk_dev.dev_id);
|
||||
exit(child_errno);
|
||||
|
||||
Reference in New Issue
Block a user