summaryrefslogtreecommitdiffstats
path: root/usr.bin/lockf
diff options
context:
space:
mode:
authorcsjp <csjp@FreeBSD.org>2005-10-09 04:45:41 +0000
committercsjp <csjp@FreeBSD.org>2005-10-09 04:45:41 +0000
commit1d5cbed356e5bc02ce5216953e497fedd36725fe (patch)
treea516f46c9dbf0f13f3db6f69a5ecab0b1c691b62 /usr.bin/lockf
parent5eb4cdb70354b3c2bcd1f2fef97b15ca44ac86e9 (diff)
downloadFreeBSD-src-1d5cbed356e5bc02ce5216953e497fedd36725fe.zip
FreeBSD-src-1d5cbed356e5bc02ce5216953e497fedd36725fe.tar.gz
Finish off style(9) fixes which I started two revisions ago. This basically
changes the indentation style from 4 spaces to 8 spaces which we expect to see in other FreeBSD source files.
Diffstat (limited to 'usr.bin/lockf')
-rw-r--r--usr.bin/lockf/lockf.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/usr.bin/lockf/lockf.c b/usr.bin/lockf/lockf.c
index 7fb8791..58a08a3 100644
--- a/usr.bin/lockf/lockf.c
+++ b/usr.bin/lockf/lockf.c
@@ -131,10 +131,11 @@ main(int argc, char **argv)
static void
cleanup(void)
{
- if (keep)
- flock(lockfd, LOCK_UN);
- else
- unlink(lockname);
+
+ if (keep)
+ flock(lockfd, LOCK_UN);
+ else
+ unlink(lockname);
}
/*
@@ -144,10 +145,11 @@ cleanup(void)
static void
killed(int sig)
{
- cleanup();
- signal(sig, SIG_DFL);
- if (kill(getpid(), sig) == -1)
- err(EX_OSERR, "kill failed");
+
+ cleanup();
+ signal(sig, SIG_DFL);
+ if (kill(getpid(), sig) == -1)
+ err(EX_OSERR, "kill failed");
}
/*
@@ -156,15 +158,17 @@ killed(int sig)
static void
timeout(int sig __unused)
{
- timed_out = 1;
+
+ timed_out = 1;
}
static void
usage(void)
{
- fprintf(stderr,
- "usage: lockf [-ks] [-t seconds] file command [arguments]\n");
- exit(EX_USAGE);
+
+ fprintf(stderr,
+ "usage: lockf [-ks] [-t seconds] file command [arguments]\n");
+ exit(EX_USAGE);
}
/*
@@ -173,12 +177,12 @@ usage(void)
static int
wait_for_lock(const char *name, int flags)
{
- int fd;
-
- if ((fd = open(name, O_CREAT|O_RDONLY|O_EXLOCK|flags, 0666)) == -1) {
- if (errno == EINTR || errno == EAGAIN)
- return (-1);
- err(EX_CANTCREAT, "cannot open %s", name);
- }
- return (fd);
+ int fd;
+
+ if ((fd = open(name, O_CREAT|O_RDONLY|O_EXLOCK|flags, 0666)) == -1) {
+ if (errno == EINTR || errno == EAGAIN)
+ return (-1);
+ err(EX_CANTCREAT, "cannot open %s", name);
+ }
+ return (fd);
}
OpenPOWER on IntegriCloud