diff --git a/lockdev-1.0.0-rh.patch b/lockdev-1.0.0-rh.patch index b71c652..af5dfdf 100644 --- a/lockdev-1.0.0-rh.patch +++ b/lockdev-1.0.0-rh.patch @@ -1,5 +1,5 @@ --- lockdev-1.0.0/src/sample.c.rh Wed Dec 1 06:50:09 1999 -+++ lockdev-1.0.0/src/sample.c Thu Aug 9 22:46:37 2001 ++++ lockdev-1.0.0/src/sample.c Tue Aug 14 14:27:39 2001 @@ -3,27 +3,26 @@ void @@ -36,7 +36,7 @@ case 'd': debug = atoi(++p); break; -@@ -32,31 +31,20 @@ +@@ -32,31 +31,28 @@ } else dev = p; } @@ -68,15 +68,24 @@ default: - i = dev_testlock( dev); + if (dev) -+ i = dev_testlock(dev); ++ i = dev_testlock(dev); break; } - exit( i); -+ exit(i); - } +-} ++ /* ++ * Exit dev_lock dev_unlock dev_testlock ++ * 0 OK OK not locked ++ * 1 locked other locked other locked ++ * 255 fail fail fail ++ */ ++ if (i < 0) i = 255; ++ else if (i > 0) i = 1; ++ exit(i); ++} --- lockdev-1.0.0/src/lockdev.c.rh Wed Dec 1 06:43:47 1999 -+++ lockdev-1.0.0/src/lockdev.c Thu Aug 9 22:48:42 2001 ++++ lockdev-1.0.0/src/lockdev.c Tue Aug 14 14:25:55 2001 @@ -176,6 +176,19 @@ liblockdev_debug = 0; } @@ -111,7 +120,7 @@ _debug( 3, "dev_lock(%s)\n", devname); if (oldmask == -1 ) - oldmask = umask( 0); /* give full permissions to files created */ -+ oldmask = umask( 002); ++ oldmask = umask( 002); /* apply o-w to files created */ if ( ! (p=_dl_check_devname( devname)) ) close_n_return( -1); strcpy( device, DEV_PATH); @@ -119,7 +128,7 @@ if ( stat( device, &statbuf) == -1 ) { close_n_return( -1); } -+ if ( access( device, W_OK ) == -1 ) { ++ if ( access( device, W_OK ) == -1 ) { + close_n_return( -1); + } @@ -134,47 +143,45 @@ _debug( 3, "dev_relock(%s, %d)\n", devname, (int)old_pid); if (oldmask == -1 ) - oldmask = umask( 0); /* give full permissions to files created */ -+ oldmask = umask( 002); ++ oldmask = umask( 002); /* apply o-w to files created */ if ( ! (p=_dl_check_devname( devname)) ) close_n_return( -1); strcpy( device, DEV_PATH); -@@ -755,9 +771,11 @@ +@@ -755,9 +771,12 @@ if ( stat( device, &statbuf) == -1 ) { close_n_return( -1); } -- -+ if ( access( device, W_OK ) == -1 ) { ++ if ( access( device, W_OK ) == -1 ) { + close_n_return( -1); + } + /* now get our own pid */ - our_pid = getpid(); + our_pid = dev_getpid(); _debug( 2, "dev_relock() our own pid = %d\n", (int)our_pid); /* first check for the FSSTND-1.2 lock, get the pid of the -@@ -828,7 +846,7 @@ +@@ -828,7 +847,7 @@ #endif /* DEBUG */ _debug( 3, "dev_unlock(%s, %d)\n", devname, (int)pid); if (oldmask == -1 ) - oldmask = umask( 0); /* give full permissions to files created */ -+ oldmask = umask( 002); ++ oldmask = umask( 002); /* apply o-w to files created */ if ( ! (p=_dl_check_devname( devname)) ) close_n_return( -1); strcpy( device, DEV_PATH); -@@ -841,7 +859,10 @@ +@@ -841,6 +860,9 @@ if ( stat( device, &statbuf) == -1 ) { close_n_return( -1); } -- -+ if ( access( device, W_OK ) == -1 ) { ++ if ( access( device, W_OK ) == -1 ) { + close_n_return( -1); + } -+ + /* first remove the FSSTND-1.2 lock, get the pid of the * owner of the lock and test for its existence; in case, - * return the pid of the owner of the lock. --- lockdev-1.0.0/src/lockdev.h.rh Wed Dec 1 06:39:42 1999 -+++ lockdev-1.0.0/src/lockdev.h Thu Aug 9 22:46:37 2001 ++++ lockdev-1.0.0/src/lockdev.h Tue Aug 14 14:19:58 2001 @@ -60,6 +60,9 @@ void liblockdev_incr_debug __P(()); void liblockdev_reset_debug __P(()); @@ -185,9 +192,9 @@ pid_t dev_testlock __P(( const char * devname)); pid_t dev_lock __P(( const char * devname)); ---- lockdev-1.0.0/src/baudboy.h.rh Thu Aug 9 22:46:37 2001 -+++ lockdev-1.0.0/src/baudboy.h Thu Aug 9 22:46:37 2001 -@@ -0,0 +1,82 @@ +--- lockdev-1.0.0/src/baudboy.h.rh Tue Aug 14 14:19:58 2001 ++++ lockdev-1.0.0/src/baudboy.h Tue Aug 14 14:21:37 2001 +@@ -0,0 +1,83 @@ +#ifndef _BADUBOY_H_ +#define _BAUDBOY_H_ + @@ -220,8 +227,9 @@ + dup2(fd, 0); + dup2(fd, 1); + dup2(fd, 2); -+ execv(argv[0], (char *const *)argv); -+ exit(-1); ++ close(fd); ++ execv(argv[0], (char *const *)argv); ++ exit(-1); + } + + rc = (int) waitpid(child, &status, 0); @@ -271,7 +279,7 @@ + +#endif /* _BAUDBOY_H_ */ --- lockdev-1.0.0/Makefile.rh Wed Dec 1 05:56:22 1999 -+++ lockdev-1.0.0/Makefile Thu Aug 9 22:46:37 2001 ++++ lockdev-1.0.0/Makefile Tue Aug 14 14:19:58 2001 @@ -6,6 +6,8 @@ objs = src/lockdev.o diff --git a/lockdev.spec b/lockdev.spec index 8ab8b23..b365f85 100644 --- a/lockdev.spec +++ b/lockdev.spec @@ -1,7 +1,7 @@ Summary: A library for locking devices. Name: lockdev Version: 1.0.0 -Release: 10 +Release: 11 Copyright: LGPL Group: System Environment/Libraries Source: ftp://ftp.debian.org/debian/dists/woody/main/source/libs/lockdev_1.0.0.tar.gz @@ -63,6 +63,9 @@ rm -fr $RPM_BUILD_ROOT %{_includedir}/* %changelog +* Tue Aug 14 2001 Jeff Johnson +- set exit status correctly. + * Thu Aug 9 2001 Bill Nottingham - check that we can open the device r/w before locking - fix calling lockdev without any arguments