/*
- * udev_utils.c - generic stuff used by udev
- *
* Copyright (C) 2004-2005 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
*
* 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.
*
*/
{
struct dirent *ent;
DIR *dir;
- char *ext;
char filename[PATH_SIZE];
dbg("open directory '%s'", dirname);
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';
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
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