Skip to content

Commit

Permalink
backends/rng-random: Get rid of qemu_open_old()
Browse files Browse the repository at this point in the history
For qemu_open_old(), osdep.h said:

> Don't introduce new usage of this function, prefer the following
> qemu_open/qemu_create that take an "Error **errp".

So replace qemu_open_old() with qemu_open(). And considering
rng_random_opened() will lose its obvious error handling case after
removing error_setg_file_open(), add comment to remind here.

Cc: Laurent Vivier <[email protected]>
Cc: Amit Shah <[email protected]>
Signed-off-by: Zhao Liu <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Michael Tokarev <[email protected]>
(mjt: drop superfluous commit as suggested by philmd)
Signed-off-by: Michael Tokarev <[email protected]>
  • Loading branch information
trueptolemy authored and Michael Tokarev committed Jul 17, 2024
1 parent 47cd2f1 commit 18f3a07
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions backends/rng-random.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ static void rng_random_opened(RngBackend *b, Error **errp)
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
"filename", "a valid filename");
} else {
s->fd = qemu_open_old(s->filename, O_RDONLY | O_NONBLOCK);
if (s->fd == -1) {
error_setg_file_open(errp, errno, s->filename);
}
s->fd = qemu_open(s->filename, O_RDONLY | O_NONBLOCK, errp);
}
}

Expand Down

0 comments on commit 18f3a07

Please sign in to comment.