auto-import changelog data from lockdev-1.0.0-14.src.rpm
Tue Sep 04 2001 Jeff Johnson <jbj@redhat.com> - swap egid and gid for lockdev's access(2) device check (#52029). Tue Aug 28 2001 Jeff Johnson <jbj@redhat.com> - typo in include file (#52704). - map specific errno's into status for return from helper.
This commit is contained in:
parent
973ca3a6df
commit
7394653a58
@ -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.rh Wed Dec 1 06:50:09 1999
|
||||||
+++ lockdev-1.0.0/src/sample.c Tue Aug 14 14:27:39 2001
|
+++ lockdev-1.0.0/src/sample.c Tue Sep 4 13:39:00 2001
|
||||||
@@ -3,27 +3,26 @@
|
@@ -3,27 +3,26 @@
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
ch = '\0';
|
ch = '\0';
|
||||||
- for( i = argc - 1; i > 0; i-- ) {
|
- for( i = argc - 1; i > 0; i-- ) {
|
||||||
+ for(i = argc - 1; i > 0; i--) {
|
+ for (i = argc - 1; i > 0; i--) {
|
||||||
p = argv[i];
|
p = argv[i];
|
||||||
- if( *p == '-' ) {
|
- if( *p == '-' ) {
|
||||||
- switch( *++p ) {
|
- switch( *++p ) {
|
||||||
@ -36,7 +36,7 @@
|
|||||||
case 'd':
|
case 'd':
|
||||||
debug = atoi(++p);
|
debug = atoi(++p);
|
||||||
break;
|
break;
|
||||||
@@ -32,31 +31,28 @@
|
@@ -32,31 +31,52 @@
|
||||||
}
|
}
|
||||||
else dev = p;
|
else dev = p;
|
||||||
}
|
}
|
||||||
@ -78,14 +78,38 @@
|
|||||||
+ * Exit dev_lock dev_unlock dev_testlock
|
+ * Exit dev_lock dev_unlock dev_testlock
|
||||||
+ * 0 OK OK not locked
|
+ * 0 OK OK not locked
|
||||||
+ * 1 locked other locked other locked
|
+ * 1 locked other locked other locked
|
||||||
+ * 255 fail fail fail
|
+ * 2 EACCES
|
||||||
|
+ * 3 EROFS
|
||||||
|
+ * 4 EFAULT
|
||||||
|
+ * 5 EINVAL
|
||||||
|
+ * 6 ENAMETOOLONG
|
||||||
|
+ * 7 ENOENT
|
||||||
|
+ * 8 ENOTDIR
|
||||||
|
+ * 9 ENOMEM
|
||||||
|
+ * 10 ELOOP
|
||||||
|
+ * 11 EIO
|
||||||
|
+ * 255 error error error
|
||||||
+ */
|
+ */
|
||||||
+ if (i < 0) i = 255;
|
+ switch (i) {
|
||||||
+ else if (i > 0) i = 1;
|
+ case -EACCES: i = 2; break;
|
||||||
|
+ case -EROFS: i = 3; break;
|
||||||
|
+ case -EFAULT: i = 4; break;
|
||||||
|
+ case -EINVAL: i = 5; break;
|
||||||
|
+ case -ENAMETOOLONG: i = 6; break;
|
||||||
|
+ case -ENOENT: i = 7; break;
|
||||||
|
+ case -ENOTDIR: i = 8; break;
|
||||||
|
+ case -ENOMEM: i = 9; break;
|
||||||
|
+ case -ELOOP: i = 10; break;
|
||||||
|
+ case -EIO: i = 11; break;
|
||||||
|
+ default:
|
||||||
|
+ if (i < 0) i = 255;
|
||||||
|
+ else if (i > 0) i = 1;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
+ exit(i);
|
+ exit(i);
|
||||||
+}
|
+}
|
||||||
--- lockdev-1.0.0/src/lockdev.c.rh Wed Dec 1 06:43:47 1999
|
--- lockdev-1.0.0/src/lockdev.c.rh Wed Dec 1 06:43:47 1999
|
||||||
+++ lockdev-1.0.0/src/lockdev.c Tue Aug 14 14:25:55 2001
|
+++ lockdev-1.0.0/src/lockdev.c Tue Sep 4 13:39:00 2001
|
||||||
@@ -176,6 +176,19 @@
|
@@ -176,6 +176,19 @@
|
||||||
liblockdev_debug = 0;
|
liblockdev_debug = 0;
|
||||||
}
|
}
|
||||||
@ -115,6 +139,15 @@
|
|||||||
unlink( tpname); /* in case there was */
|
unlink( tpname); /* in case there was */
|
||||||
rename( lockname, tpname);
|
rename( lockname, tpname);
|
||||||
if ( ! (fd=fopen( tpname, "r")) ) {
|
if ( ! (fd=fopen( tpname, "r")) ) {
|
||||||
|
@@ -520,7 +533,7 @@
|
||||||
|
* and minor numbers
|
||||||
|
*/
|
||||||
|
if ( stat( device, &statbuf) == -1 ) {
|
||||||
|
- close_n_return( -1);
|
||||||
|
+ close_n_return(-errno);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* first check for the FSSTND-1.2 lock, get the pid of the
|
||||||
@@ -586,7 +599,7 @@
|
@@ -586,7 +599,7 @@
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
_debug( 3, "dev_lock(%s)\n", devname);
|
_debug( 3, "dev_lock(%s)\n", devname);
|
||||||
@ -124,13 +157,16 @@
|
|||||||
if ( ! (p=_dl_check_devname( devname)) )
|
if ( ! (p=_dl_check_devname( devname)) )
|
||||||
close_n_return( -1);
|
close_n_return( -1);
|
||||||
strcpy( device, DEV_PATH);
|
strcpy( device, DEV_PATH);
|
||||||
@@ -599,9 +612,12 @@
|
@@ -597,11 +610,14 @@
|
||||||
|
* and minor numbers
|
||||||
|
*/
|
||||||
if ( stat( device, &statbuf) == -1 ) {
|
if ( stat( device, &statbuf) == -1 ) {
|
||||||
close_n_return( -1);
|
- close_n_return( -1);
|
||||||
}
|
+ close_n_return(-errno);
|
||||||
+ if ( access( device, W_OK ) == -1 ) {
|
|
||||||
+ close_n_return( -1);
|
|
||||||
+ }
|
+ }
|
||||||
|
+ if ( access( device, W_OK ) == -1 ) {
|
||||||
|
+ close_n_return(-errno);
|
||||||
|
}
|
||||||
|
|
||||||
/* now get our own pid */
|
/* now get our own pid */
|
||||||
- our_pid = getpid();
|
- our_pid = getpid();
|
||||||
@ -138,7 +174,30 @@
|
|||||||
_debug( 2, "dev_lock() our own pid = %d\n", (int)our_pid);
|
_debug( 2, "dev_lock() our own pid = %d\n", (int)our_pid);
|
||||||
|
|
||||||
/* We will use this algorithm:
|
/* We will use this algorithm:
|
||||||
@@ -742,7 +758,7 @@
|
@@ -642,8 +658,9 @@
|
||||||
|
_dl_filename_1( lock1, &statbuf);
|
||||||
|
while ( ! (pid=_dl_check_lock( lock1)) ) {
|
||||||
|
if (( link( lock0, lock1) == -1 ) && ( errno != EEXIST )) {
|
||||||
|
+ int rc = -errno;
|
||||||
|
unlink( lock0);
|
||||||
|
- close_n_return( -1);
|
||||||
|
+ close_n_return(rc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( pid != our_pid ) {
|
||||||
|
@@ -660,9 +677,10 @@
|
||||||
|
/* lockfile of type /var/lock/LCK..ttyS2 */
|
||||||
|
while ( ! (pid=_dl_check_lock( lock2)) ) {
|
||||||
|
if (( link( lock0, lock2) == -1 ) && ( errno != EEXIST )) {
|
||||||
|
+ int rc = -errno;
|
||||||
|
unlink( lock0);
|
||||||
|
unlink( lock1);
|
||||||
|
- close_n_return( -1);
|
||||||
|
+ close_n_return(rc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( pid != our_pid ) {
|
||||||
|
@@ -742,7 +760,7 @@
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
_debug( 3, "dev_relock(%s, %d)\n", devname, (int)old_pid);
|
_debug( 3, "dev_relock(%s, %d)\n", devname, (int)old_pid);
|
||||||
if (oldmask == -1 )
|
if (oldmask == -1 )
|
||||||
@ -147,13 +206,16 @@
|
|||||||
if ( ! (p=_dl_check_devname( devname)) )
|
if ( ! (p=_dl_check_devname( devname)) )
|
||||||
close_n_return( -1);
|
close_n_return( -1);
|
||||||
strcpy( device, DEV_PATH);
|
strcpy( device, DEV_PATH);
|
||||||
@@ -755,9 +771,12 @@
|
@@ -753,11 +771,14 @@
|
||||||
|
* and minor numbers
|
||||||
|
*/
|
||||||
if ( stat( device, &statbuf) == -1 ) {
|
if ( stat( device, &statbuf) == -1 ) {
|
||||||
close_n_return( -1);
|
- close_n_return( -1);
|
||||||
}
|
+ close_n_return(-errno);
|
||||||
+ if ( access( device, W_OK ) == -1 ) {
|
|
||||||
+ close_n_return( -1);
|
|
||||||
+ }
|
+ }
|
||||||
|
+ if ( access( device, W_OK ) == -1 ) {
|
||||||
|
+ close_n_return(-errno);
|
||||||
|
}
|
||||||
|
|
||||||
/* now get our own pid */
|
/* now get our own pid */
|
||||||
- our_pid = getpid();
|
- our_pid = getpid();
|
||||||
@ -161,7 +223,7 @@
|
|||||||
_debug( 2, "dev_relock() our own pid = %d\n", (int)our_pid);
|
_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
|
/* first check for the FSSTND-1.2 lock, get the pid of the
|
||||||
@@ -828,7 +847,7 @@
|
@@ -828,7 +849,7 @@
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
_debug( 3, "dev_unlock(%s, %d)\n", devname, (int)pid);
|
_debug( 3, "dev_unlock(%s, %d)\n", devname, (int)pid);
|
||||||
if (oldmask == -1 )
|
if (oldmask == -1 )
|
||||||
@ -170,19 +232,29 @@
|
|||||||
if ( ! (p=_dl_check_devname( devname)) )
|
if ( ! (p=_dl_check_devname( devname)) )
|
||||||
close_n_return( -1);
|
close_n_return( -1);
|
||||||
strcpy( device, DEV_PATH);
|
strcpy( device, DEV_PATH);
|
||||||
@@ -841,6 +860,9 @@
|
@@ -839,7 +860,10 @@
|
||||||
|
* and minor numbers
|
||||||
|
*/
|
||||||
if ( stat( device, &statbuf) == -1 ) {
|
if ( stat( device, &statbuf) == -1 ) {
|
||||||
close_n_return( -1);
|
- close_n_return( -1);
|
||||||
}
|
+ close_n_return(-errno);
|
||||||
+ if ( access( device, W_OK ) == -1 ) {
|
|
||||||
+ close_n_return( -1);
|
|
||||||
+ }
|
+ }
|
||||||
|
+ if ( access( device, W_OK ) == -1 ) {
|
||||||
|
+ close_n_return(-errno);
|
||||||
|
}
|
||||||
|
|
||||||
/* first remove the FSSTND-1.2 lock, get the pid of the
|
/* first remove the FSSTND-1.2 lock, get the pid of the
|
||||||
* owner of the lock and test for its existence; in case,
|
|
||||||
--- lockdev-1.0.0/src/lockdev.h.rh Wed Dec 1 06:39:42 1999
|
--- lockdev-1.0.0/src/lockdev.h.rh Wed Dec 1 06:39:42 1999
|
||||||
+++ lockdev-1.0.0/src/lockdev.h Tue Aug 14 14:19:58 2001
|
+++ lockdev-1.0.0/src/lockdev.h Tue Sep 4 13:39:00 2001
|
||||||
@@ -60,6 +60,9 @@
|
@@ -53,6 +53,7 @@
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
+#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* API of the library */
|
||||||
|
@@ -60,6 +61,9 @@
|
||||||
void liblockdev_incr_debug __P(());
|
void liblockdev_incr_debug __P(());
|
||||||
void liblockdev_reset_debug __P(());
|
void liblockdev_reset_debug __P(());
|
||||||
|
|
||||||
@ -192,10 +264,10 @@
|
|||||||
pid_t dev_testlock __P(( const char * devname));
|
pid_t dev_testlock __P(( const char * devname));
|
||||||
|
|
||||||
pid_t dev_lock __P(( const char * devname));
|
pid_t dev_lock __P(( const char * devname));
|
||||||
--- lockdev-1.0.0/src/baudboy.h.rh Tue Aug 14 14:19:58 2001
|
--- lockdev-1.0.0/src/baudboy.h.rh Tue Sep 4 13:39:00 2001
|
||||||
+++ lockdev-1.0.0/src/baudboy.h Tue Aug 14 14:21:37 2001
|
+++ lockdev-1.0.0/src/baudboy.h Tue Sep 4 13:44:47 2001
|
||||||
@@ -0,0 +1,83 @@
|
@@ -0,0 +1,118 @@
|
||||||
+#ifndef _BADUBOY_H_
|
+#ifndef _BAUDBOY_H_
|
||||||
+#define _BAUDBOY_H_
|
+#define _BAUDBOY_H_
|
||||||
+
|
+
|
||||||
+#include <stdio.h>
|
+#include <stdio.h>
|
||||||
@ -204,6 +276,7 @@
|
|||||||
+#include <signal.h>
|
+#include <signal.h>
|
||||||
+#include <sys/wait.h>
|
+#include <sys/wait.h>
|
||||||
+#include <sys/types.h>
|
+#include <sys/types.h>
|
||||||
|
+#include <errno.h>
|
||||||
+#include <unistd.h>
|
+#include <unistd.h>
|
||||||
+
|
+
|
||||||
+#ifdef __cplusplus
|
+#ifdef __cplusplus
|
||||||
@ -228,6 +301,8 @@
|
|||||||
+ dup2(fd, 1);
|
+ dup2(fd, 1);
|
||||||
+ dup2(fd, 2);
|
+ dup2(fd, 2);
|
||||||
+ close(fd);
|
+ close(fd);
|
||||||
|
+ /* Swap egid and gid for lockdev's access(2) device check. */
|
||||||
|
+ setregid(getegid(), getgid());
|
||||||
+ execv(argv[0], (char *const *)argv);
|
+ execv(argv[0], (char *const *)argv);
|
||||||
+ exit(-1);
|
+ exit(-1);
|
||||||
+ }
|
+ }
|
||||||
@ -235,10 +310,42 @@
|
|||||||
+ rc = (int) waitpid(child, &status, 0);
|
+ rc = (int) waitpid(child, &status, 0);
|
||||||
+ signal(SIGCHLD, osig);
|
+ signal(SIGCHLD, osig);
|
||||||
+ if (rc == child && WIFEXITED(status)) {
|
+ if (rc == child && WIFEXITED(status)) {
|
||||||
|
+ /*
|
||||||
|
+ * Exit dev_lock dev_unlock dev_testlock
|
||||||
|
+ * 0 OK OK not locked
|
||||||
|
+ * 1 locked other locked other locked
|
||||||
|
+ * 2 EACCES
|
||||||
|
+ * 3 EROFS
|
||||||
|
+ * 4 EFAULT
|
||||||
|
+ * 5 EINVAL
|
||||||
|
+ * 6 ENAMETOOLONG
|
||||||
|
+ * 7 ENOENT
|
||||||
|
+ * 8 ENOTDIR
|
||||||
|
+ * 9 ENOMEM
|
||||||
|
+ * 10 ELOOP
|
||||||
|
+ * 11 EIO
|
||||||
|
+ * 255 error error error
|
||||||
|
+ */
|
||||||
+ rc = WEXITSTATUS(status);
|
+ rc = WEXITSTATUS(status);
|
||||||
+ if (rc == 255) rc = -1;
|
+ switch(rc) {
|
||||||
+ } else
|
+ case 0: rc = 0; break;
|
||||||
+ rc = -1;
|
+ default:
|
||||||
|
+ case 1: rc = -EPERM; break;
|
||||||
|
+ case 2: rc = -EACCES; break;
|
||||||
|
+ case 3: rc = -EROFS; break;
|
||||||
|
+ case 4: rc = -EFAULT; break;
|
||||||
|
+ case 5: rc = -EINVAL; break;
|
||||||
|
+ case 6: rc = -ENAMETOOLONG; break;
|
||||||
|
+ case 7: rc = -ENOENT; break;
|
||||||
|
+ case 8: rc = -ENOTDIR; break;
|
||||||
|
+ case 9: rc = -ENOMEM; break;
|
||||||
|
+ case 10: rc = -ELOOP; break;
|
||||||
|
+ case 11: rc = -EIO; break;
|
||||||
|
+ }
|
||||||
|
+ } else if (rc == -1)
|
||||||
|
+ rc = -errno;
|
||||||
|
+ else
|
||||||
|
+ rc = -ECHILD;
|
||||||
+
|
+
|
||||||
+ return rc;
|
+ return rc;
|
||||||
+
|
+
|
||||||
@ -279,7 +386,7 @@
|
|||||||
+
|
+
|
||||||
+#endif /* _BAUDBOY_H_ */
|
+#endif /* _BAUDBOY_H_ */
|
||||||
--- lockdev-1.0.0/Makefile.rh Wed Dec 1 05:56:22 1999
|
--- lockdev-1.0.0/Makefile.rh Wed Dec 1 05:56:22 1999
|
||||||
+++ lockdev-1.0.0/Makefile Tue Aug 14 14:19:58 2001
|
+++ lockdev-1.0.0/Makefile Tue Sep 4 13:39:00 2001
|
||||||
@@ -6,6 +6,8 @@
|
@@ -6,6 +6,8 @@
|
||||||
|
|
||||||
objs = src/lockdev.o
|
objs = src/lockdev.o
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Summary: A library for locking devices.
|
Summary: A library for locking devices.
|
||||||
Name: lockdev
|
Name: lockdev
|
||||||
Version: 1.0.0
|
Version: 1.0.0
|
||||||
Release: 11
|
Release: 14
|
||||||
Copyright: LGPL
|
Copyright: LGPL
|
||||||
Group: System Environment/Libraries
|
Group: System Environment/Libraries
|
||||||
Source: ftp://ftp.debian.org/debian/dists/woody/main/source/libs/lockdev_1.0.0.tar.gz
|
Source: ftp://ftp.debian.org/debian/dists/woody/main/source/libs/lockdev_1.0.0.tar.gz
|
||||||
@ -63,6 +63,13 @@ rm -fr $RPM_BUILD_ROOT
|
|||||||
%{_includedir}/*
|
%{_includedir}/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Sep 4 2001 Jeff Johnson <jbj@redhat.com>
|
||||||
|
- swap egid and gid for lockdev's access(2) device check (#52029).
|
||||||
|
|
||||||
|
* Tue Aug 28 2001 Jeff Johnson <jbj@redhat.com>
|
||||||
|
- typo in include file (#52704).
|
||||||
|
- map specific errno's into status for return from helper.
|
||||||
|
|
||||||
* Tue Aug 14 2001 Jeff Johnson <jbj@redhat.com>
|
* Tue Aug 14 2001 Jeff Johnson <jbj@redhat.com>
|
||||||
- set exit status correctly.
|
- set exit status correctly.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user