summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorSebastian Benoit <benno@cvs.openbsd.org>2016-08-31 23:49:17 +0000
committerSebastian Benoit <benno@cvs.openbsd.org>2016-08-31 23:49:17 +0000
commit1640276d43e4bdbd14613d4e5b175dd6c23c8d87 (patch)
tree872b1f68a17b3aae36343a4687d180eef3e66aa8 /usr.sbin
parent5ae1e7f49b2e2f0cee83f6a3b15cac9682b56c81 (diff)
whitespace
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/acme-client/util.c67
1 files changed, 33 insertions, 34 deletions
diff --git a/usr.sbin/acme-client/util.c b/usr.sbin/acme-client/util.c
index d7e5b6322c6..61ed418be43 100644
--- a/usr.sbin/acme-client/util.c
+++ b/usr.sbin/acme-client/util.c
@@ -1,4 +1,4 @@
-/* $Id: util.c,v 1.1 2016/08/31 22:01:42 florian Exp $ */
+/* $Id: util.c,v 1.2 2016/08/31 23:49:16 benno Exp $ */
/*
* Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -90,20 +90,20 @@ sigpipe(int code)
long
readop(int fd, enum comm comm)
{
- ssize_t ssz;
+ ssize_t ssz;
long op;
ssz = read(fd, &op, sizeof(long));
if (ssz < 0) {
warn("read: %s", comms[comm]);
- return(LONG_MAX);
+ return (LONG_MAX);
} else if (ssz && ssz != sizeof(long)) {
warnx("short read: %s", comms[comm]);
- return(LONG_MAX);
+ return (LONG_MAX);
} else if (0 == ssz)
- return(0);
+ return (0);
- return(op);
+ return (op);
}
char *
@@ -111,7 +111,7 @@ readstr(int fd, enum comm comm)
{
size_t sz;
- return(readbuf(fd, comm, &sz));
+ return (readbuf(fd, comm, &sz));
}
/*
@@ -131,16 +131,16 @@ readbuf(int fd, enum comm comm, size_t *sz)
if ((ssz = read(fd, sz, sizeof(size_t))) < 0) {
warn("read: %s length", comms[comm]);
- return(NULL);
+ return (NULL);
} else if ((size_t)ssz != sizeof(size_t)) {
warnx("short read: %s length", comms[comm]);
- return(NULL);
+ return (NULL);
} else if (*sz > SIZE_MAX - 1) {
warnx("integer overflow");
- return(NULL);
+ return (NULL);
} else if (NULL == (p = calloc(1, *sz + 1))) {
warn("malloc");
- return(NULL);
+ return (NULL);
}
/* Catch this over several reads. */
@@ -161,10 +161,10 @@ readbuf(int fd, enum comm comm, size_t *sz)
if (lsz) {
warnx("couldn't read buffer: %s", comms[comm]);
free(p);
- return(NULL);
+ return (NULL);
}
- return(p);
+ return (p);
}
/*
@@ -184,17 +184,17 @@ writeop(int fd, enum comm comm, long op)
if (EPIPE != (er = errno))
warn("write: %s", comms[comm]);
signal(SIGPIPE, sigfp);
- return(EPIPE == er ? 0 : -1);
+ return (EPIPE == er ? 0 : -1);
}
signal(SIGPIPE, sigfp);
if ((size_t)ssz != sizeof(long)) {
warnx("short write: %s", comms[comm]);
- return(-1);
- }
+ return (-1);
+ }
- return(1);
+ return (1);
}
/*
@@ -223,12 +223,12 @@ writebuf(int fd, enum comm comm, const void *v, size_t sz)
if (EPIPE != (er = errno))
warn("write: %s length", comms[comm]);
signal(SIGPIPE, sigfp);
- return(EPIPE == er ? 0 : -1);
+ return (EPIPE == er ? 0 : -1);
}
/* Now write errors cause us to bail. */
- if ((size_t)ssz != sizeof(size_t))
+ if ((size_t)ssz != sizeof(size_t))
warnx("short write: %s length", comms[comm]);
else if ((ssz = write(fd, v, sz)) < 0)
warn("write: %s", comms[comm]);
@@ -238,14 +238,14 @@ writebuf(int fd, enum comm comm, const void *v, size_t sz)
rc = 1;
signal(SIGPIPE, sigfp);
- return(rc);
+ return (rc);
}
int
writestr(int fd, enum comm comm, const char *v)
{
- return(writebuf(fd, comm, v, strlen(v)));
+ return (writebuf(fd, comm, v, strlen(v)));
}
/*
@@ -261,21 +261,21 @@ checkexit(pid_t pid, enum comp comp)
if (-1 == waitpid(pid, &c, 0)) {
warn("waitpid");
- return(0);
+ return (0);
} else if ( ! WIFEXITED(c) && WIFSIGNALED(c)) {
cp = strsignal(WTERMSIG(c));
warnx("signal: %s(%u): %s", comps[comp], pid, cp);
- return(0);
+ return (0);
} else if ( ! WIFEXITED(c)) {
warnx("did not exit: %s(%u)", comps[comp], pid);
- return(0);
+ return (0);
} else if (EXIT_SUCCESS != WEXITSTATUS(c)) {
cc = WEXITSTATUS(c);
dodbg("bad exit: %s(%u): %d", comps[comp], pid, cc);
- return(0);
+ return (0);
}
- return(1);
+ return (1);
}
/*
@@ -294,24 +294,23 @@ checkexit_ext(int *rc, pid_t pid, enum comp comp)
if (-1 == waitpid(pid, &c, 0)) {
warn("waitpid");
- return(0);
+ return (0);
}
if ( ! WIFEXITED(c) && WIFSIGNALED(c)) {
cp = strsignal(WTERMSIG(c));
warnx("signal: %s(%u): %s", comps[comp], pid, cp);
- return(0);
+ return (0);
} else if ( ! WIFEXITED(c)) {
warnx("did not exit: %s(%u)", comps[comp], pid);
- return(0);
- }
-
+ return (0);
+ }
+
/* Now check extended status. */
if (EXIT_SUCCESS != (*rc = WEXITSTATUS(c)) && 2 != *rc) {
dodbg("bad exit: %s(%u): %d", comps[comp], pid, *rc);
- return(0);
+ return (0);
}
- return(1);
+ return (1);
}
-