X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=src%2Fshared%2Ffdset.c;h=e9802bb82caadde96c44e3246f582449aaa6e301;hb=11a15892230011c331d4e31cdbbd58e8b3dfe4af;hp=527f27bc67a730a5ef596ca20facb079cf46b8c1;hpb=4b7abb5b1186422637089f2863cb8c3705c026e0;p=thirdparty%2Fsystemd.git diff --git a/src/shared/fdset.c b/src/shared/fdset.c index 527f27bc67a..e9802bb82ca 100644 --- a/src/shared/fdset.c +++ b/src/shared/fdset.c @@ -1,30 +1,19 @@ +/* SPDX-License-Identifier: LGPL-2.1+ */ /*** This file is part of systemd. Copyright 2010 Lennart Poettering - - systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with systemd; If not, see . ***/ #include -#include #include #include #include #include "sd-daemon.h" +#include "alloc-util.h" +#include "dirent-util.h" #include "fd-util.h" #include "fdset.h" #include "log.h" @@ -148,12 +137,9 @@ int fdset_new_fill(FDSet **_s) { goto finish; } - while ((de = readdir(d))) { + FOREACH_DIRENT(de, d, return -errno) { int fd = -1; - if (hidden_or_backup_file(de->d_name)) - continue; - r = safe_atoi(de->d_name, &fd); if (r < 0) goto finish; @@ -170,8 +156,7 @@ int fdset_new_fill(FDSet **_s) { } r = 0; - *_s = s; - s = NULL; + *_s = TAKE_PTR(s); finish: /* We won't close the fds here! */