summaryrefslogtreecommitdiff
path: root/src/notify
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/notify
parent754d8b9c330150fdb3767491e24975f7dfe2a203 (diff)
downloadsystemd-e652663a043cb80936bb12ad5c87766fc5150c24.tar.gz
tree-wide: use parse_fd()
Diffstat (limited to 'src/notify')
-rw-r--r--src/notify/notify.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/notify/notify.c b/src/notify/notify.c
index 8a551a9399..8d8e6db072 100644
--- a/src/notify/notify.c
+++ b/src/notify/notify.c
@@ -215,11 +215,11 @@ static int parse_argv(int argc, char *argv[]) {
_cleanup_close_ int owned_fd = -EBADF;
int fdnr;
- r = safe_atoi(optarg, &fdnr);
- if (r < 0)
- return log_error_errno(r, "Failed to parse file descriptor: %s", optarg);
+ fdnr = parse_fd(optarg);
+ if (fdnr == -ERANGE)
+ return log_error_errno(fdnr, "File descriptor can't be negative: %s", optarg);
if (fdnr < 0)
- return log_error_errno(SYNTHETIC_ERRNO(ERANGE), "File descriptor can't be negative: %i", fdnr);
+ return log_error_errno(fdnr, "Failed to parse file descriptor: %s", optarg);
if (!passed) {
/* Take possession of all passed fds */