summaryrefslogtreecommitdiff
path: root/src/udev/udev-event.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-12-24 16:39:37 +0100
committerLennart Poettering <lennart@poettering.net>2013-12-24 16:39:37 +0100
commit9f6445e34a57c270f013c9416c123e56261553dd (patch)
tree51bd61c2671a564b1fda28b998dcb3b0ddb4c8ed /src/udev/udev-event.c
parentae98841e63a2624700db84ba44217f768b090d99 (diff)
log: log_error() and friends add a newline after each line anyway, so avoid including it in the log strings
Diffstat (limited to 'src/udev/udev-event.c')
-rw-r--r--src/udev/udev-event.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index 0d1049cf1c..5aec077043 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -175,7 +175,7 @@ subst:
from++;
for (i = 0; from[i] != '}'; i++) {
if (from[i] == '\0') {
- log_error("missing closing brace for format '%s'\n", src);
+ log_error("missing closing brace for format '%s'", src);
goto out;
}
}
@@ -256,7 +256,7 @@ subst:
cpos++;
}
if (i > 0) {
- log_error("requested part of result string not found\n");
+ log_error("requested part of result string not found");
break;
}
strscpy(tmp, sizeof(tmp), cpos);
@@ -279,7 +279,7 @@ subst:
int count;
if (attr == NULL) {
- log_error("missing file parameter for attr\n");
+ log_error("missing file parameter for attr");
break;
}
@@ -306,7 +306,7 @@ subst:
vbuf[len] = '\0';
count = util_replace_chars(vbuf, UDEV_ALLOWED_CHARS_INPUT);
if (count > 0)
- log_debug("%i character(s) replaced\n" , count);
+ log_debug("%i character(s) replaced" , count);
l = strpcpy(&s, l, vbuf);
break;
}
@@ -364,7 +364,7 @@ subst:
break;
}
default:
- log_error("unknown substitution type=%i\n", type);
+ log_error("unknown substitution type=%i", type);
break;
}
}
@@ -391,7 +391,7 @@ static int spawn_exec(struct udev_event *event,
dup2(fd, STDERR_FILENO);
close(fd);
} else {
- log_error("open /dev/null failed: %m\n");
+ log_error("open /dev/null failed: %m");
}
/* connect pipes to std{out,err} */
@@ -415,7 +415,7 @@ static int spawn_exec(struct udev_event *event,
/* exec failed */
err = -errno;
- log_error("failed to execute '%s' '%s': %m\n", argv[0], cmd);
+ log_error("failed to execute '%s' '%s': %m", argv[0], cmd);
return err;
}
@@ -434,7 +434,7 @@ static void spawn_read(struct udev_event *event,
fd_ep = epoll_create1(EPOLL_CLOEXEC);
if (fd_ep < 0) {
- log_error("error creating epoll fd: %m\n");
+ log_error("error creating epoll fd: %m");
goto out;
}
@@ -443,7 +443,7 @@ static void spawn_read(struct udev_event *event,
ep_outpipe.events = EPOLLIN;
ep_outpipe.data.ptr = &fd_stdout;
if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_stdout, &ep_outpipe) < 0) {
- log_error("fail to add fd to epoll: %m\n");
+ log_error("fail to add fd to epoll: %m");
goto out;
}
}
@@ -453,7 +453,7 @@ static void spawn_read(struct udev_event *event,
ep_errpipe.events = EPOLLIN;
ep_errpipe.data.ptr = &fd_stderr;
if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_stderr, &ep_errpipe) < 0) {
- log_error("fail to add fd to epoll: %m\n");
+ log_error("fail to add fd to epoll: %m");
goto out;
}
}
@@ -470,7 +470,7 @@ static void spawn_read(struct udev_event *event,
age_usec = now(CLOCK_MONOTONIC) - event->birth_usec;
if (age_usec >= event->timeout_usec) {
- log_error("timeout '%s'\n", cmd);
+ log_error("timeout '%s'", cmd);
goto out;
}
timeout = ((event->timeout_usec - age_usec) / 1000) + 1000;
@@ -482,11 +482,11 @@ static void spawn_read(struct udev_event *event,
if (fdcount < 0) {
if (errno == EINTR)
continue;
- log_error("failed to poll: %m\n");
+ log_error("failed to poll: %m");
goto out;
}
if (fdcount == 0) {
- log_error("timeout '%s'\n", cmd);
+ log_error("timeout '%s'", cmd);
goto out;
}
@@ -508,7 +508,7 @@ static void spawn_read(struct udev_event *event,
memcpy(&result[respos], buf, count);
respos += count;
} else {
- log_error("'%s' ressize %zd too short\n", cmd, ressize);
+ log_error("'%s' ressize %zd too short", cmd, ressize);
}
}
@@ -520,12 +520,12 @@ static void spawn_read(struct udev_event *event,
pos = buf;
while ((line = strsep(&pos, "\n"))) {
if (pos != NULL || line[0] != '\0')
- log_debug("'%s'(%s) '%s'\n", cmd, *fd == fd_stdout ? "out" : "err" , line);
+ log_debug("'%s'(%s) '%s'", cmd, *fd == fd_stdout ? "out" : "err" , line);
}
}
} else if (ev[i].events & EPOLLHUP) {
if (epoll_ctl(fd_ep, EPOLL_CTL_DEL, *fd, NULL) < 0) {
- log_error("failed to remove fd from epoll: %m\n");
+ log_error("failed to remove fd from epoll: %m");
goto out;
}
*fd = -1;
@@ -570,11 +570,11 @@ static int spawn_wait(struct udev_event *event, const char *cmd, pid_t pid)
if (errno == EINTR)
continue;
err = -errno;
- log_error("failed to poll: %m\n");
+ log_error("failed to poll: %m");
goto out;
}
if (fdcount == 0) {
- log_error("timeout: killing '%s' [%u]\n", cmd, pid);
+ log_error("timeout: killing '%s' [%u]", cmd, pid);
kill(pid, SIGKILL);
}
@@ -595,20 +595,20 @@ static int spawn_wait(struct udev_event *event, const char *cmd, pid_t pid)
if (waitpid(pid, &status, WNOHANG) < 0)
break;
if (WIFEXITED(status)) {
- log_debug("'%s' [%u] exit with return code %i\n", cmd, pid, WEXITSTATUS(status));
+ log_debug("'%s' [%u] exit with return code %i", cmd, pid, WEXITSTATUS(status));
if (WEXITSTATUS(status) != 0)
err = -1;
} else if (WIFSIGNALED(status)) {
- log_error("'%s' [%u] terminated by signal %i (%s)\n", cmd, pid, WTERMSIG(status), strsignal(WTERMSIG(status)));
+ log_error("'%s' [%u] terminated by signal %i (%s)", cmd, pid, WTERMSIG(status), strsignal(WTERMSIG(status)));
err = -1;
} else if (WIFSTOPPED(status)) {
- log_error("'%s' [%u] stopped\n", cmd, pid);
+ log_error("'%s' [%u] stopped", cmd, pid);
err = -1;
} else if (WIFCONTINUED(status)) {
- log_error("'%s' [%u] continued\n", cmd, pid);
+ log_error("'%s' [%u] continued", cmd, pid);
err = -1;
} else {
- log_error("'%s' [%u] exit with status 0x%04x\n", cmd, pid, status);
+ log_error("'%s' [%u] exit with status 0x%04x", cmd, pid, status);
err = -1;
}
pid = 0;
@@ -674,14 +674,14 @@ int udev_event_spawn(struct udev_event *event,
if (result != NULL || udev_get_log_priority(udev) >= LOG_INFO) {
if (pipe2(outpipe, O_NONBLOCK) != 0) {
err = -errno;
- log_error("pipe failed: %m\n");
+ log_error("pipe failed: %m");
goto out;
}
}
if (udev_get_log_priority(udev) >= LOG_INFO) {
if (pipe2(errpipe, O_NONBLOCK) != 0) {
err = -errno;
- log_error("pipe failed: %m\n");
+ log_error("pipe failed: %m");
goto out;
}
}
@@ -705,14 +705,14 @@ int udev_event_spawn(struct udev_event *event,
errpipe[READ_END] = -1;
}
- log_debug("starting '%s'\n", cmd);
+ log_debug("starting '%s'", cmd);
spawn_exec(event, cmd, argv, envp, sigmask,
outpipe[WRITE_END], errpipe[WRITE_END]);
_exit(2 );
case -1:
- log_error("fork of '%s' failed: %m\n", cmd);
+ log_error("fork of '%s' failed: %m", cmd);
err = -1;
goto out;
default:
@@ -755,7 +755,7 @@ static int rename_netif(struct udev_event *event)
oldname = udev_device_get_sysname(dev);
- log_debug("changing net interface name from '%s' to '%s'\n",
+ log_debug("changing net interface name from '%s' to '%s'",
oldname, event->name);
strscpy(name, IFNAMSIZ, event->name);
@@ -817,7 +817,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules,
err = rename_netif(event);
if (err == 0) {
- log_debug("renamed netif to '%s'\n", event->name);
+ log_debug("renamed netif to '%s'", event->name);
/* remember old name */
udev_device_add_property(dev, "INTERFACE_OLD", udev_device_get_sysname(dev));
@@ -830,7 +830,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules,
strscpy(pos, sizeof(syspath) - (pos - syspath), event->name);
udev_device_set_syspath(event->dev, syspath);
udev_device_add_property(dev, "INTERFACE", udev_device_get_sysname(dev));
- log_debug("changed devpath to '%s'\n", udev_device_get_devpath(dev));
+ log_debug("changed devpath to '%s'", udev_device_get_devpath(dev));
}
}
}
@@ -900,7 +900,7 @@ void udev_event_execute_run(struct udev_event *event, const sigset_t *sigmask)
char **envp;
if (event->exec_delay > 0) {
- log_debug("delay execution of '%s'\n", program);
+ log_debug("delay execution of '%s'", program);
sleep(event->exec_delay);
}