Skip to content

Commit

Permalink
build: fixing unused-result warning
Browse files Browse the repository at this point in the history
The results of calls to methods write() and read() are now checked in the debug build, which will help diagnose potential problems.

Signed-off-by: Aleksandr Golubev <[email protected]>
  • Loading branch information
Aleksandr Golubev committed Jun 17, 2024
1 parent 1cc984a commit 2cee9b2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tests/vhost_user_blk_test_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,8 @@ static void monitor_serve_unix_socket(const char *path,
static void interactive_sigint(int sig)
{
const char *const msg = "\nUse 'stop' command or Ctrl+D to exit\n";
write(2, msg, strlen(msg));
ssize_t res = write(2, msg, strlen(msg));
VHD_ASSERT(res == strlen(msg));
}

static void monitor_serve_stdio(struct disks_context *ctx)
Expand Down
3 changes: 2 additions & 1 deletion vdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1940,7 +1940,8 @@ static int timer_read(void *opaque)
uint64_t count;

/* Read the count to rearm the periodic timer, but ignore the result */
(void)read(vdev->timerfd, &count, sizeof(count));
ssize_t res = read(vdev->timerfd, &count, sizeof(count));
VHD_ASSERT(res == sizeof(count));

elapsed_time(vdev, &elapsed);

Expand Down

0 comments on commit 2cee9b2

Please sign in to comment.