X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=src%2Fudev%2Fudev-watch.c;h=9d3e69bc9382fef13ec74c346e99b3f08b40e669;hb=50d1760d2690db8636d8800b5777b03334f6afba;hp=bc9096ed0c170e087c1aed1e48e94ec90b274a89;hpb=e02c6135602bef7de81d7736d5c0959d45d5085c;p=thirdparty%2Fsystemd.git diff --git a/src/udev/udev-watch.c b/src/udev/udev-watch.c index bc9096ed0c1..9d3e69bc938 100644 --- a/src/udev/udev-watch.c +++ b/src/udev/udev-watch.c @@ -1,29 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* - * Copyright (C) 2004-2012 Kay Sievers - * Copyright (C) 2009 Canonical Ltd. - * Copyright (C) 2009 Scott James Remnant + * Copyright © 2004-2012 Kay Sievers + * Copyright © 2009 Canonical Ltd. + * Copyright © 2009 Scott James Remnant * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . */ -#include #include #include #include #include #include +#include "dirent-util.h" #include "stdio-util.h" #include "udev.h" @@ -57,7 +46,7 @@ void udev_watch_restore(struct udev *udev) { return; } - for (ent = readdir(dir); ent != NULL; ent = readdir(dir)) { + FOREACH_DIRENT_ALL(ent, dir, break) { char device[UTIL_PATH_SIZE]; ssize_t len; struct udev_device *dev; @@ -78,7 +67,7 @@ void udev_watch_restore(struct udev *udev) { udev_watch_begin(udev, dev); udev_device_unref(dev); unlink: - unlinkat(dirfd(dir), ent->d_name, 0); + (void) unlinkat(dirfd(dir), ent->d_name, 0); } closedir(dir);