summaryrefslogtreecommitdiff
path: root/src/core/main.c
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2023-05-05 09:10:49 +0200
committerDavid Tardon <dtardon@redhat.com>2023-05-05 09:10:56 +0200
commite652663a043cb80936bb12ad5c87766fc5150c24 (patch)
tree0be9d85c11057f6b66b3f4604c27fd85051a7599 /src/core/main.c
parent754d8b9c330150fdb3767491e24975f7dfe2a203 (diff)
downloadsystemd-e652663a043cb80936bb12ad5c87766fc5150c24.tar.gz
tree-wide: use parse_fd()
Diffstat (limited to 'src/core/main.c')
-rw-r--r--src/core/main.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/core/main.c b/src/core/main.c
index 0b2eb13d5e..ab545a6421 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1002,13 +1002,11 @@ static int parse_argv(int argc, char *argv[]) {
int fd;
FILE *f;
- r = safe_atoi(optarg, &fd);
- if (r < 0)
- return log_error_errno(r, "Failed to parse deserialize option \"%s\": %m", optarg);
+ fd = parse_fd(optarg);
+ if (fd == -ERANGE)
+ return log_error_errno(fd, "Invalid deserialize fd: %s", optarg);
if (fd < 0)
- return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
- "Invalid deserialize fd: %d",
- fd);
+ return log_error_errno(fd, "Failed to parse deserialize option \"%s\": %m", optarg);
(void) fd_cloexec(fd, true);