X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=udev_utils.c;h=e892012132eff8678c5a7fdd139a5a6356fc28ab;hp=b198892c012f2ae8f95356845066336f92c1ba42;hb=e578a447463ec58fd543f7b978b0804d37d854dd;hpb=3a020a85da768808a03f1574b001d1d06d55ae07 diff --git a/udev_utils.c b/udev_utils.c index b198892c0..e89201213 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -1,6 +1,4 @@ /* - * udev_utils.c - generic stuff used by udev - * * Copyright (C) 2004-2005 Kay Sievers * * This program is free software; you can redistribute it and/or modify it @@ -14,7 +12,7 @@ * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., - * 675 Mass Ave, Cambridge, MA 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ @@ -128,7 +126,6 @@ int add_matching_files(struct list_head *name_list, const char *dirname, const c { struct dirent *ent; DIR *dir; - char *ext; char filename[PATH_SIZE]; dbg("open directory '%s'", dirname); @@ -147,14 +144,16 @@ int add_matching_files(struct list_head *name_list, const char *dirname, const c continue; /* look for file matching with specified suffix */ - ext = strrchr(ent->d_name, '.'); - if (ext == NULL) - continue; - - if (strcmp(ext, suffix) != 0) - continue; - - dbg("put file '%s/%s' in list", dirname, ent->d_name); + if (suffix != NULL) { + const char *ext; + + ext = strrchr(ent->d_name, '.'); + if (ext == NULL) + continue; + if (strcmp(ext, suffix) != 0) + continue; + } + dbg("put file '%s/%s' into list", dirname, ent->d_name); snprintf(filename, sizeof(filename), "%s/%s", dirname, ent->d_name); filename[sizeof(filename)-1] = '\0'; @@ -174,7 +173,7 @@ uid_t lookup_user(const char *user) pw = getpwnam(user); if (pw == NULL) { if (errno == 0 || errno == ENOENT || errno == ESRCH) - err("specified user unknown '%s'", user); + err("specified user '%s' unknown", user); else err("error resolving user '%s': %s", user, strerror(errno)); } else @@ -192,7 +191,7 @@ extern gid_t lookup_group(const char *group) gr = getgrnam(group); if (gr == NULL) { if (errno == 0 || errno == ENOENT || errno == ESRCH) - err("specified group unknown '%s'", group); + err("specified group '%s' unknown", group); else err("error resolving group '%s': %s", group, strerror(errno)); } else