Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > 8978e4bd2af0f5855fb2f2a6d26b5583 > files > 1

lockdev-1.0.3-5.fc14.src.rpm

diff -up lockdev-1.0.3/src/lockdev.c.checkname lockdev-1.0.3/src/lockdev.c
--- lockdev-1.0.3/src/lockdev.c.checkname	2009-12-05 15:40:16.000000000 +0100
+++ lockdev-1.0.3/src/lockdev.c	2009-12-05 15:55:29.000000000 +0100
@@ -487,18 +487,19 @@ _dl_check_devname (const char *devname)
 		_debug( 3, "_dl_check_devname(%s) stripped name = %s\n", devname, p);
 	} else {
 		/* Otherwise, strip off everything but the device name. */
-		while ( (m=strrchr( p, '/')) != 0 ) {
-			p = m+1;	/* was pointing to the slash */
+		p += strspn(p, " \t\r\n\v\f\a");        /* skip leading whitespace */
+		if (strncmp(p, DEV_PATH, strlen(DEV_PATH)) == 0) {
+			p += strlen(DEV_PATH);	/* 1st char after slash */
 			_debug( 3, "_dl_check_devname(%s) name = %s\n", devname, p);
 		}
 	}
 	if ( strcmp( p, "tty") == 0 )
 		p = ttyname( 0); /* this terminal, if it exists */
-	if ( ((l=strlen( p)) == 0 ) || ( l > (MAXPATHLEN - strlen(LOCK_PATH)) ))
-	 	return 0;
-	if ( ! (m = malloc( 1 + l)) )
-		return 0;
-	return strcpy( m, p);
+	if (((l = strlen(p)) == 0) || (l > (MAXPATHLEN - strlen(LOCK_PATH))))
+	 	return NULL;
+	if ((m = malloc(++l)) == NULL)
+		return NULL;
+	return strcpy(m, p);
 }