summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--udev.c2
-rw-r--r--udev_add.c14
-rw-r--r--udev_config.c2
-rw-r--r--udev_db.c10
-rw-r--r--udev_libc_wrapper.c2
-rw-r--r--udev_remove.c7
-rw-r--r--udev_rules.c2
-rw-r--r--udev_rules_parse.c2
-rw-r--r--udev_selinux.c6
-rw-r--r--udev_utils.c2
-rw-r--r--udev_utils_file.c6
-rw-r--r--udev_utils_run.c12
-rw-r--r--udevcontrol.c4
-rw-r--r--udevd.c20
-rw-r--r--udeveventrecorder.c2
-rw-r--r--udevmonitor.c14
-rw-r--r--udevsend.c10
17 files changed, 58 insertions, 59 deletions
diff --git a/udev.c b/udev.c
index aab9f015fb..17867180c7 100644
--- a/udev.c
+++ b/udev.c
@@ -95,7 +95,7 @@ int main(int argc, char *argv[], char *envp[])
logging_init("udev");
if (devnull < 0)
- err("fatal, could not open /dev/null");
+ err("fatal, could not open /dev/null: %s", strerror(errno));
udev_init_config();
dbg("version %s", UDEV_VERSION);
diff --git a/udev_add.c b/udev_add.c
index 9420b4fe14..a811b5a17c 100644
--- a/udev_add.c
+++ b/udev_add.c
@@ -73,7 +73,7 @@ int udev_make_node(struct udevice *udev, const char *file, dev_t devt, mode_t mo
}
if (unlink(file) != 0)
- dbg("unlink(%s) failed with error '%s'", file, strerror(errno));
+ dbg("unlink(%s) failed: %s", file, strerror(errno));
else
dbg("already present file '%s' unlinked", file);
@@ -82,7 +82,7 @@ create:
retval = mknod(file, mode, devt);
selinux_resetfscreatecon();
if (retval != 0) {
- err("mknod(%s, %#o, %u, %u) failed with error '%s'",
+ err("mknod(%s, %#o, %u, %u) failed: %s",
file, mode, major(devt), minor(devt), strerror(errno));
goto exit;
}
@@ -90,14 +90,14 @@ create:
perms:
dbg("chmod(%s, %#o)", file, mode);
if (chmod(file, mode) != 0) {
- dbg("chmod(%s, %#o) failed with error '%s'", file, mode, strerror(errno));
+ dbg("chmod(%s, %#o) failed: %s", file, mode, strerror(errno));
goto exit;
}
if (uid != 0 || gid != 0) {
dbg("chown(%s, %u, %u)", file, uid, gid);
if (chown(file, uid, gid) != 0) {
- dbg("chown(%s, %u, %u) failed with error '%s'",
+ dbg("chown(%s, %u, %u) failed: %s",
file, uid, gid, strerror(errno));
goto exit;
}
@@ -222,7 +222,7 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de
retval = symlink(linktarget, filename);
selinux_resetfscreatecon();
if (retval != 0)
- dbg("symlink(%s, %s) failed with error '%s'",
+ dbg("symlink(%s, %s) failed: %s",
linktarget, filename, strerror(errno));
}
}
@@ -244,7 +244,7 @@ static int rename_net_if(struct udevice *udev)
sk = socket(PF_INET, SOCK_DGRAM, 0);
if (sk < 0) {
- dbg("error opening socket");
+ dbg("error opening socket: %s", strerror(errno));
return -1;
}
@@ -254,7 +254,7 @@ static int rename_net_if(struct udevice *udev)
retval = ioctl(sk, SIOCSIFNAME, &ifr);
if (retval != 0)
- dbg("error changing net interface name");
+ dbg("error changing net interface name: %s", strerror(errno));
close(sk);
return retval;
diff --git a/udev_config.c b/udev_config.c
index b8c4ffc8ed..192a0b80d2 100644
--- a/udev_config.c
+++ b/udev_config.c
@@ -107,7 +107,7 @@ static int parse_config_file(void)
int retval = 0;
if (file_map(udev_config_filename, &buf, &bufsize) != 0) {
- err("can't open '%s' as config file", udev_config_filename);
+ err("can't open '%s' as config file: %s", udev_config_filename, strerror(errno));
return -ENODEV;
}
diff --git a/udev_db.c b/udev_db.c
index bf369ac2e6..f00308bd2f 100644
--- a/udev_db.c
+++ b/udev_db.c
@@ -95,7 +95,7 @@ int udev_db_add_device(struct udevice *udev)
create_path(filename);
f = fopen(filename, "w");
if (f == NULL) {
- err("unable to create db file '%s'", filename);
+ err("unable to create db file '%s': %s", filename, strerror(errno));
return -1;
}
dbg("storing data for device '%s' in '%s'", udev->devpath, filename);
@@ -129,7 +129,7 @@ int udev_db_get_device(struct udevice *udev, const char *devpath)
devpath_to_db_path(devpath, filename, sizeof(filename));
if (file_map(filename, &buf, &bufsize) != 0) {
- dbg("no db file to read '%s'", filename);
+ dbg("no db file to read %s: %s", filename, strerror(errno));
return -1;
}
@@ -210,7 +210,7 @@ int udev_db_lookup_name(const char *name, char *devpath, size_t len)
dir = opendir(udev_db_path);
if (dir == NULL) {
- err("unable to open udev_db '%s'", udev_db_path);
+ err("unable to open udev_db '%s': %s", udev_db_path, strerror(errno));
return -1;
}
@@ -235,7 +235,7 @@ int udev_db_lookup_name(const char *name, char *devpath, size_t len)
dbg("looking at '%s'", filename);
if (file_map(filename, &buf, &bufsize) != 0) {
- err("unable to read db file '%s'", filename);
+ err("unable to read db file '%s': %s", filename, strerror(errno));
continue;
}
@@ -278,7 +278,7 @@ int udev_db_get_all_entries(struct list_head *name_list)
dir = opendir(udev_db_path);
if (dir == NULL) {
- err("unable to open udev_db '%s'", udev_db_path);
+ err("unable to open udev_db '%s': %s", udev_db_path, strerror(errno));
return -1;
}
diff --git a/udev_libc_wrapper.c b/udev_libc_wrapper.c
index 4e9f9f1fe8..a7a8c5342d 100644
--- a/udev_libc_wrapper.c
+++ b/udev_libc_wrapper.c
@@ -144,7 +144,7 @@ static unsigned long get_id_by_name(const char *uname, const char *dbfile)
char *tail;
if (file_map(dbfile, &buf, &bufsize) != 0) {
- dbg("can't open '%s' as db file", dbfile);
+ dbg("can't open '%s' as db file: %s", dbfile, strerror(errno));
return 0;
}
dbg("search '%s' in '%s'", uname, dbfile);
diff --git a/udev_remove.c b/udev_remove.c
index 0d536bc8ff..621fcc1960 100644
--- a/udev_remove.c
+++ b/udev_remove.c
@@ -56,8 +56,7 @@ static int delete_path(const char *path)
if (retval) {
if (errno == ENOTEMPTY)
return 0;
- dbg("rmdir(%s) failed with error '%s'",
- path, strerror(errno));
+ dbg("rmdir(%s) failed: %s", path, strerror(errno));
break;
}
dbg("removed '%s'", path);
@@ -153,8 +152,8 @@ int udev_remove_device(struct udevice *udev)
dbg("remove name='%s'", udev->name);
udev_db_delete_device(udev);
} else {
- dbg("'%s' not found in database, using kernel name '%s'", udev->devpath, udev->kernel_name);
- strlcpy(udev->name, udev->kernel_name, sizeof(udev->name));
+ dbg("'%s' not found in database, don't remove anything", udev->devpath);
+ return -1;
}
return delete_node(udev);
diff --git a/udev_rules.c b/udev_rules.c
index ad3629d39d..137ad27dba 100644
--- a/udev_rules.c
+++ b/udev_rules.c
@@ -208,7 +208,7 @@ static int import_file_into_env(struct udevice *udev, const char *filename)
size_t bufsize;
if (file_map(filename, &buf, &bufsize) != 0) {
- err("can't open '%s'", filename);
+ err("can't open '%s': %s", filename, strerror(errno));
return -1;
}
import_keys_into_env(udev, buf, bufsize);
diff --git a/udev_rules_parse.c b/udev_rules_parse.c
index 9041c383e0..b664b983fb 100644
--- a/udev_rules_parse.c
+++ b/udev_rules_parse.c
@@ -538,7 +538,7 @@ static int parse_file(struct udev_rules *rules, const char *filename)
int retval = 0;
if (file_map(filename, &buf, &bufsize) != 0) {
- err("can't open '%s' as rules file", filename);
+ err("can't open '%s' as rules file: %s", filename, strerror(errno));
return -1;
}
dbg("reading '%s' as rules file", filename);
diff --git a/udev_selinux.c b/udev_selinux.c
index cc6f4d7d3f..719ff6403e 100644
--- a/udev_selinux.c
+++ b/udev_selinux.c
@@ -105,7 +105,7 @@ void selinux_setfilecon(const char *file, const char *devname, unsigned int mode
}
if (setfilecon(file, scontext) < 0)
- dbg("setfilecon %s failed with error '%s'", file, strerror(errno));
+ dbg("setfilecon %s failed: %s", file, strerror(errno));
freecon(scontext);
}
@@ -131,7 +131,7 @@ void selinux_setfscreatecon(const char *file, const char *devname, unsigned int
}
if (setfscreatecon(scontext) < 0)
- dbg("setfscreatecon %s failed with error '%s'", file, strerror(errno));
+ dbg("setfscreatecon %s failed: %s", file, strerror(errno));
freecon(scontext);
}
@@ -141,7 +141,7 @@ void selinux_resetfscreatecon(void)
{
if (is_selinux_running()) {
if (setfscreatecon(prev_scontext) < 0)
- dbg("setfscreatecon %s failed with error '%s'", file, strerror(errno));
+ dbg("setfscreatecon failed: %s", strerror(errno));
}
}
diff --git a/udev_utils.c b/udev_utils.c
index 683378aadf..04258a39c2 100644
--- a/udev_utils.c
+++ b/udev_utils.c
@@ -139,7 +139,7 @@ int add_matching_files(struct list_head *name_list, const char *dirname, const c
dbg("open directory '%s'", dirname);
dir = opendir(dirname);
if (dir == NULL) {
- dbg("unable to open '%s'", dirname);
+ dbg("unable to open '%s': %s", dirname, strerror(errno));
return -1;
}
diff --git a/udev_utils_file.c b/udev_utils_file.c
index f8518f64ad..23f61196b7 100644
--- a/udev_utils_file.c
+++ b/udev_utils_file.c
@@ -72,18 +72,18 @@ int unlink_secure(const char *filename)
retval = chown(filename, 0, 0);
if (retval)
- dbg("chown(%s, 0, 0) failed with error '%s'", filename, strerror(errno));
+ dbg("chown(%s, 0, 0) failed: %s", filename, strerror(errno));
retval = chmod(filename, 0000);
if (retval)
- dbg("chmod(%s, 0000) failed with error '%s'", filename, strerror(errno));
+ dbg("chmod(%s, 0000) failed: %s", filename, strerror(errno));
retval = unlink(filename);
if (errno == ENOENT)
retval = 0;
if (retval)
- dbg("unlink(%s) failed with error '%s'", filename, strerror(errno));
+ dbg("unlink(%s) failed: %s", filename, strerror(errno));
return retval;
}
diff --git a/udev_utils_run.c b/udev_utils_run.c
index 1315154c26..20aaa4ab05 100644
--- a/udev_utils_run.c
+++ b/udev_utils_run.c
@@ -115,13 +115,13 @@ int run_program(const char *command, const char *subsystem,
/* prepare pipes from child to parent */
if (result || log) {
if (pipe(outpipe) != 0) {
- err("pipe failed");
+ err("pipe failed: %s", strerror(errno));
return -1;
}
}
if (log) {
if (pipe(errpipe) != 0) {
- err("pipe failed");
+ err("pipe failed: %s", strerror(errno));
return -1;
}
}
@@ -145,7 +145,7 @@ int run_program(const char *command, const char *subsystem,
dup2(devnull, STDERR_FILENO);
close(devnull);
} else
- err("open /dev/null failed");
+ err("open /dev/null failed: %s", strerror(errno));
if (outpipe[WRITE_END] > 0)
dup2(outpipe[WRITE_END], STDOUT_FILENO);
if (errpipe[WRITE_END] > 0)
@@ -156,7 +156,7 @@ int run_program(const char *command, const char *subsystem,
err("exec of program '%s' failed", argv[0]);
_exit(1);
case -1:
- err("fork of '%s' failed", argv[0]);
+ err("fork of '%s' failed: %s", argv[0], strerror(errno));
return -1;
default:
/* read from child if requested */
@@ -199,7 +199,7 @@ int run_program(const char *command, const char *subsystem,
close(outpipe[READ_END]);
outpipe[READ_END] = -1;
if (count < 0) {
- err("stdin read failed with '%s'", strerror(errno));
+ err("stdin read failed: %s", strerror(errno));
retval = -1;
}
continue;
@@ -233,7 +233,7 @@ int run_program(const char *command, const char *subsystem,
close(errpipe[READ_END]);
errpipe[READ_END] = -1;
if (count < 0)
- err("stderr read failed with '%s'", strerror(errno));
+ err("stderr read failed: %s", strerror(errno));
continue;
}
errbuf[count] = '\0';
diff --git a/udevcontrol.c b/udevcontrol.c
index 00b435edc4..bd6563531d 100644
--- a/udevcontrol.c
+++ b/udevcontrol.c
@@ -125,7 +125,7 @@ int main(int argc, char *argv[], char *envp[])
sock = socket(AF_LOCAL, SOCK_DGRAM, 0);
if (sock == -1) {
- err("error getting socket");
+ err("error getting socket: %s", strerror(errno));
goto exit;
}
@@ -138,7 +138,7 @@ int main(int argc, char *argv[], char *envp[])
retval = sendto(sock, &usend_msg, sizeof(usend_msg), 0, (struct sockaddr *)&saddr, addrlen);
if (retval == -1) {
- info("error sending message (%s)", strerror(errno));
+ err("error sending message: %s", strerror(errno));
retval = 1;
} else {
dbg("sent message type=0x%02x, %u bytes sent", usend_msg.type, retval);
diff --git a/udevd.c b/udevd.c
index ddf72738c3..86905923be 100644
--- a/udevd.c
+++ b/udevd.c
@@ -160,7 +160,7 @@ static void udev_event_run(struct uevent_msg *msg)
logging_close();
exit(0);
case -1:
- err("fork of child failed");
+ err("fork of child failed: %s", strerror(errno));
msg_queue_delete(msg);
break;
default:
@@ -460,7 +460,7 @@ static struct uevent_msg *get_udevd_msg(void)
size = recvmsg(udevd_sock, &smsg, 0);
if (size < 0) {
if (errno != EINTR)
- err("unable to receive udevd message");
+ err("unable to receive udevd message: %s", strerror(errno));
return NULL;
}
cmsg = CMSG_FIRSTHDR(&smsg);
@@ -535,7 +535,7 @@ static struct uevent_msg *get_netlink_msg(void)
size = recv(uevent_netlink_sock, &buffer, sizeof(buffer), 0);
if (size < 0) {
if (errno != EINTR)
- err("unable to receive udevd message");
+ err("unable to receive udevd message: %s", strerror(errno));
return NULL;
}
@@ -640,7 +640,7 @@ static int init_udevd_socket(void)
udevd_sock = socket(AF_LOCAL, SOCK_DGRAM, 0);
if (udevd_sock == -1) {
- err("error getting socket, %s", strerror(errno));
+ err("error getting socket: %s", strerror(errno));
return -1;
}
@@ -650,7 +650,7 @@ static int init_udevd_socket(void)
/* the bind takes care of ensuring only one copy running */
retval = bind(udevd_sock, (struct sockaddr *) &saddr, addrlen);
if (retval < 0) {
- err("bind failed, %s", strerror(errno));
+ err("bind failed: %s", strerror(errno));
return -1;
}
@@ -673,7 +673,7 @@ static int init_uevent_netlink_sock(void)
uevent_netlink_sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT);
if (uevent_netlink_sock == -1) {
- err("error getting socket, %s", strerror(errno));
+ err("error getting socket: %s", strerror(errno));
return -1;
}
@@ -682,7 +682,7 @@ static int init_uevent_netlink_sock(void)
retval = bind(uevent_netlink_sock, (struct sockaddr *) &snl, sizeof(struct sockaddr_nl));
if (retval < 0) {
- err("bind failed, %s", strerror(errno));
+ err("bind failed: %s", strerror(errno));
close(uevent_netlink_sock);
uevent_netlink_sock = -1;
return -1;
@@ -717,7 +717,7 @@ int main(int argc, char *argv[], char *envp[])
logging_init("udevd");
if (fd < 0)
- err("fatal, could not open /dev/null");
+ err("fatal, could not open /dev/null: %s", strerror(errno));
udev_init_config();
dbg("version %s", UDEV_VERSION);
@@ -770,7 +770,7 @@ int main(int argc, char *argv[], char *envp[])
dbg("daemonized fork running");
break;
case -1:
- err("fork of daemon failed");
+ err("fork of daemon failed: %s", strerror(errno));
rc = 4;
goto exit;
default:
@@ -792,7 +792,7 @@ int main(int argc, char *argv[], char *envp[])
/* OOM_DISABLE == -17 */
fd = open("/proc/self/oom_adj", O_RDWR);
if (fd < 0)
- err("error disabling OOM");
+ err("error disabling OOM: %s", strerror(errno));
else {
write(fd, "-17", 3);
close(fd);
diff --git a/udeveventrecorder.c b/udeveventrecorder.c
index 8ac344a47e..422cf88ff0 100644
--- a/udeveventrecorder.c
+++ b/udeveventrecorder.c
@@ -84,7 +84,7 @@ int main(int argc, char **argv, char **envp)
snprintf(buf, FNSIZE, "/events/debug.%05lu.%s.%s.%u", seq, argv[1], a ? a : "", getpid());
if ((fd = open(buf, O_CREAT | O_WRONLY | O_TRUNC, 0644)) < 0) {
- err("error creating '%s'", buf);
+ err("error creating '%s': %s", buf, strerror(errno));
goto error;
}
free(buf);
diff --git a/udevmonitor.c b/udevmonitor.c
index dc04649745..805790233f 100644
--- a/udevmonitor.c
+++ b/udevmonitor.c
@@ -55,14 +55,14 @@ static int init_udev_monitor_socket(void)
udev_monitor_sock = socket(AF_LOCAL, SOCK_DGRAM, 0);
if (udev_monitor_sock == -1) {
- fprintf(stderr, "error getting socket, %s\n", strerror(errno));
+ fprintf(stderr, "error getting socket: %s\n", strerror(errno));
return -1;
}
/* the bind takes care of ensuring only one copy running */
retval = bind(udev_monitor_sock, (struct sockaddr *) &saddr, addrlen);
if (retval < 0) {
- fprintf(stderr, "bind failed, %s\n", strerror(errno));
+ fprintf(stderr, "bind failed: %s\n", strerror(errno));
close(udev_monitor_sock);
udev_monitor_sock = -1;
return -1;
@@ -86,14 +86,14 @@ static int init_uevent_netlink_sock(void)
uevent_netlink_sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT);
if (uevent_netlink_sock == -1) {
- fprintf(stderr, "error getting socket, %s\n", strerror(errno));
+ fprintf(stderr, "error getting socket: %s\n", strerror(errno));
return -1;
}
retval = bind(uevent_netlink_sock, (struct sockaddr *) &snl,
sizeof(struct sockaddr_nl));
if (retval < 0) {
- fprintf(stderr, "bind failed, %s\n", strerror(errno));
+ fprintf(stderr, "bind failed: %s\n", strerror(errno));
close(uevent_netlink_sock);
uevent_netlink_sock = -1;
return -1;
@@ -173,7 +173,7 @@ int main(int argc, char *argv[])
fdcount = select(UDEV_MAX(uevent_netlink_sock, udev_monitor_sock)+1, &readfds, NULL, NULL, NULL);
if (fdcount < 0) {
if (errno != EINTR)
- fprintf(stderr, "error receiving uevent message\n");
+ fprintf(stderr, "error receiving uevent message: %s\n", strerror(errno));
continue;
}
@@ -186,7 +186,7 @@ int main(int argc, char *argv[])
if ((uevent_netlink_sock > 0) && FD_ISSET(uevent_netlink_sock, &readfds)) {
buflen = recv(uevent_netlink_sock, &buf, sizeof(buf), 0);
if (buflen <= 0) {
- fprintf(stderr, "error receiving uevent message\n");
+ fprintf(stderr, "error receiving uevent message: %s\n", strerror(errno));
continue;
}
printf("UEVENT[%s] %s\n", timestr, buf);
@@ -195,7 +195,7 @@ int main(int argc, char *argv[])
if ((udev_monitor_sock > 0) && FD_ISSET(udev_monitor_sock, &readfds)) {
buflen = recv(udev_monitor_sock, &buf, sizeof(buf), 0);
if (buflen <= 0) {
- fprintf(stderr, "error receiving udev message\n");
+ fprintf(stderr, "error receiving udev message: %s\n", strerror(errno));
continue;
}
printf("UDEV [%s] %s\n", timestr, buf);
diff --git a/udevsend.c b/udevsend.c
index 29d5bc155e..d0cfc2af53 100644
--- a/udevsend.c
+++ b/udevsend.c
@@ -71,17 +71,17 @@ static int start_daemon(void)
/* daemon with empty environment */
close(sock);
execve(UDEVD_BIN, argv, envp);
- err("exec of daemon failed");
+ err("exec of daemon failed: %s", strerror(errno));
_exit(1);
case -1:
- err("fork of daemon failed");
+ err("fork of daemon failed: %s", strerror(errno));
return -1;
default:
exit(0);
}
break;
case -1:
- err("fork of helper failed");
+ err("fork of helper failed: %s", strerror(errno));
return -1;
default:
waitpid(pid, NULL, 0);
@@ -110,7 +110,7 @@ int main(int argc, char *argv[], char *envp[])
sock = socket(AF_LOCAL, SOCK_DGRAM, 0);
if (sock == -1) {
- err("error getting socket");
+ err("error getting socket: %s", strerror(errno));
goto exit;
}
@@ -170,7 +170,7 @@ int main(int argc, char *argv[], char *envp[])
}
if (errno != ECONNREFUSED) {
- err("error sending message (%s)", strerror(errno));
+ err("error sending message: %s", strerror(errno));
goto exit;
}