diff --git a/Changelog b/Changelog index 8a8e902..341ffdf 100644 --- a/Changelog +++ b/Changelog @@ -47,9 +47,9 @@ liblockfile (1.13) * remove '-t' as option when running a command- do touchlock automatically if -p was not given. - * drop effective gid asap, retain as saved gid. only restore egid if nessecary. + * drop effective gid asap, retain as saved gid. only restore egid if necessary. * if stat() fails, drop saved gid as well, and retry (sshfs is strict) - * don't allow executing a command with the -m option, not nessecary. + * don't allow executing a command with the -m option, not necessary. should really add a minimal setgid util for maillock(), remove setgid from dotlockfile, and let it use the library maillock(). @@ -294,7 +294,7 @@ liblockfile (0.1-2) unstable; urgency=low * Compiled with libc6 and with -lc * Compile with -D_REENTRANT and -D_GNU_SOURCE * Apart from returning the L_XXX values, also set errno to something - resonable. + reasonable. * Reckognize common NFS lockfiles from mailx -- Miquel van Smoorenburg Wed, 24 Sep 1997 12:52:44 +0200 diff --git a/Makefile.in b/Makefile.in index 9c74b35..dc411df 100644 --- a/Makefile.in +++ b/Makefile.in @@ -115,4 +115,3 @@ distclean: clean rm -f Makefile autoconf.h maillock.h \ config.cache config.log config.status; \ rm -rf autom4te.cache - diff --git a/README b/README index 00ce0f2..d0aa2ee 100644 --- a/README +++ b/README @@ -1,4 +1,3 @@ - README for liblockfile @@ -37,5 +36,3 @@ lockfile_create, lockfile_remove, lockfile_touch, lockfile_check - lockfile_create.3 - - diff --git a/acconfig.h b/acconfig.h index b27bf11..e4c9ab7 100644 --- a/acconfig.h +++ b/acconfig.h @@ -10,4 +10,3 @@ config.h - created by autoconf; contains defines generated by autoconf /* Is the mailspool group writable */ #undef MAILGROUP - diff --git a/dotlockfile.c b/dotlockfile.c index 3670ecc..10a9bef 100644 --- a/dotlockfile.c +++ b/dotlockfile.c @@ -81,7 +81,7 @@ int set_signal(int sig, void (*handler)(int)) } /* - * Sleep for an amount of time while regulary checking if + * Sleep for an amount of time while regularly checking if * our parent is still alive. */ int check_sleep(int sleeptime, int flags) @@ -104,7 +104,7 @@ int check_sleep(int sleeptime, int flags) } /* - * Split a filename up in file and directory. + * Split a filename up in file and directory. */ int fn_split(char *fn, char **fn_p, char **dir_p) { @@ -164,7 +164,7 @@ void perror_exit(const char *why) { } /* - * Print usage mesage and exit. + * Print usage message and exit. */ void usage(void) { @@ -322,7 +322,7 @@ int main(int argc, char **argv) if (gid != egid) { /* * See if the requested lock is for a mailbox. - * First, remember currect working directory. + * First, remember current working directory. */ #ifdef O_PATH cwd_fd = open(".", O_PATH|O_CLOEXEC); @@ -456,4 +456,3 @@ int main(int argc, char **argv) } return 0; } - diff --git a/lockfile.c b/lockfile.c index 8131866..5ad5b3b 100644 --- a/lockfile.c +++ b/lockfile.c @@ -611,4 +611,3 @@ void touchlock(void) lockfile_touch(mlockfile); } #endif - diff --git a/lockfile_create.3 b/lockfile_create.3 index a042d29..0706b6d 100644 --- a/lockfile_create.3 +++ b/lockfile_create.3 @@ -1,4 +1,4 @@ -.TH LOCKFILE_CREATE 3 "27 Januari 2021" "Linux Manpage" "Linux Programmer's Manual" +.TH LOCKFILE_CREATE 3 "27 January 2021" "Linux Manpage" "Linux Programmer's Manual" .SH NAME lockfile_create, lockfile_remove, lockfile_touch, lockfile_check \- manage lockfiles .SH SYNOPSIS @@ -126,7 +126,7 @@ However in a lot of cases, such as Unix mailboxes, all concerned programs accessing the mailboxes agree on the fact that the presence of .lock means that is locked. .PP -If you are using +If you are using .B lockfile_create to create a lock on a file that resides on a remote server, and you already have that file open, you need to flush the NFS attribute cache @@ -138,7 +138,7 @@ o open /var/mail/USERNAME .TP 3 o -attributes, such as size, inode, etc are now cached in the kernel! +attributes, such as size, inode, etc are now cached in the kernel! .TP 3 o meanwhile, another remote system appends data to /var/mail/USERNAME diff --git a/maillock.3 b/maillock.3 index 127f498..55afa9f 100644 --- a/maillock.3 +++ b/maillock.3 @@ -62,7 +62,7 @@ These functions call .BR lockfile_create "(3)" to do the work. That function might spawn a set group-id executable to do the actual locking if the current process doesn't have enough -priviliges. +privileges. .PP There are some issues with flushing the kernels attribute cache if you are using NFS - see the diff --git a/nfslock.c b/nfslock.c index f1c7e75..f0f5676 100644 --- a/nfslock.c +++ b/nfslock.c @@ -230,4 +230,3 @@ int creat(const char *file, mode_t mode) { return open(file, O_CREAT|O_WRONLY|O_TRUNC, mode); } - diff --git a/run-tests.sh b/run-tests.sh index ca839b3..0aaa732 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -1,4 +1,4 @@ -#! /bin/sh +#!/bin/sh # # Some simple tests to check if locking/unlocking works correctly. # @@ -25,13 +25,11 @@ PID=$! sleep 1 # locking again should fail -if dotlockfile -l -r 0 testlock.lock -then - if kill -0 $PID 2>/dev/null - then - echo "double lock while running command" - exit 1 - fi +if dotlockfile -l -r 0 testlock.lock; then + if kill -0 "$PID" 2>/dev/null; then + echo "double lock while running command" + exit 1 + fi fi # lock should be gone when command completes @@ -50,11 +48,10 @@ dotlockfile -u testlock.lock wait time_end=$(date '+%s') -time_elapsed=`expr $time_end - $time_start` +time_elapsed=$((time_end - time_start)) # Time should equal 8 seconds -[ "$time_elapsed" = '8' ] || { echo "lockfile should take 8 seconds to be replaced. [$time_elapsed]"; exit 1; } +[ "$time_elapsed" = 8 ] || { echo "lockfile should take 8 seconds to be replaced. [$time_elapsed]"; exit 1; } [ ! -f testlock.lock ] || { echo "lockfile still exists after running cmd"; exit 1; } echo "tests OK" -