summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2017-12-25 14:14:45 -0800
committerJohn Crispin <john@phrozen.org>2018-01-02 13:01:31 +0100
commit810d7a51c584673f3511f1fa2eb447c67fd7f88e (patch)
treebed84075d507bdeea0ded29cd8f41dc2d6db215b
parentfa5ce1c2b4fe3fa6bb4bbc6697961655b952d8d4 (diff)
downloadprocd-810d7a51c584673f3511f1fa2eb447c67fd7f88e.tar.gz
procd: Remove redundant errno variable in several printf functions.
%m, aka strerror(errno) is already used. No need to repeat it. Saves 280 bytes. Signed-off-by: Rosen Penev <rosenp@gmail.com>
-rw-r--r--service/instance.c24
-rw-r--r--utils/utils.c4
2 files changed, 14 insertions, 14 deletions
diff --git a/service/instance.c b/service/instance.c
index 25735ab..7447bad 100644
--- a/service/instance.c
+++ b/service/instance.c
@@ -241,8 +241,8 @@ instance_removepid(struct service_instance *in) {
if (!in->pidfile)
return 0;
if (unlink(in->pidfile)) {
- ERROR("Failed to removed pidfile: %s: %d - %m\n",
- in->pidfile, errno);
+ ERROR("Failed to removed pidfile: %s: %m\n",
+ in->pidfile);
return 1;
}
return 0;
@@ -258,19 +258,19 @@ instance_writepid(struct service_instance *in)
}
_pidfile = fopen(in->pidfile, "w");
if (_pidfile == NULL) {
- ERROR("failed to open pidfile for writing: %s: %d (%m)",
- in->pidfile, errno);
+ ERROR("failed to open pidfile for writing: %s: %m",
+ in->pidfile);
return 1;
}
if (fprintf(_pidfile, "%d\n", in->proc.pid) < 0) {
- ERROR("failed to write pidfile: %s: %d (%m)",
- in->pidfile, errno);
+ ERROR("failed to write pidfile: %s: %m",
+ in->pidfile);
fclose(_pidfile);
return 2;
}
if (fclose(_pidfile)) {
- ERROR("failed to close pidfile: %s: %d (%m)",
- in->pidfile, errno);
+ ERROR("failed to close pidfile: %s: %m",
+ in->pidfile);
return 3;
}
@@ -353,11 +353,11 @@ instance_run(struct service_instance *in, int _stdout, int _stderr)
}
if (in->gid && setgid(in->gid)) {
- ERROR("failed to set group id %d: %d (%m)\n", in->gid, errno);
+ ERROR("failed to set group id %d: %m\n", in->gid);
exit(127);
}
if (in->uid && setuid(in->uid)) {
- ERROR("failed to set user id %d: %d (%m)\n", in->uid, errno);
+ ERROR("failed to set user id %d: %m\n", in->uid);
exit(127);
}
@@ -407,14 +407,14 @@ instance_start(struct service_instance *in)
instance_free_stdio(in);
if (in->_stdout.fd.fd > -2) {
if (pipe(opipe)) {
- ULOG_WARN("pipe() failed: %d (%m)\n", errno);
+ ULOG_WARN("pipe() failed: %m\n");
opipe[0] = opipe[1] = -1;
}
}
if (in->_stderr.fd.fd > -2) {
if (pipe(epipe)) {
- ULOG_WARN("pipe() failed: %d (%m)\n", errno);
+ ULOG_WARN("pipe() failed: %m\n");
epipe[0] = epipe[1] = -1;
}
}
diff --git a/utils/utils.c b/utils/utils.c
index 57c82eb..c5b9513 100644
--- a/utils/utils.c
+++ b/utils/utils.c
@@ -203,8 +203,8 @@ int patch_stdio(const char *device)
for (fd = STDIN_FILENO; fd <= STDERR_FILENO; fd++) {
if (patch_fd(device, fd, fd ? O_WRONLY : O_RDONLY)) {
- ERROR("Failed to redirect %s to %s: %d (%m)\n",
- fdname[fd], device, errno);
+ ERROR("Failed to redirect %s to %s: %m\n",
+ fdname[fd], device);
rv = -1;
}
}