File cksfv-1.3.14-fix_hangs.patch of Package cksfv

Index: cksfv.1
===================================================================
--- cksfv.1.orig
+++ cksfv.1
@@ -52,8 +52,9 @@ to verify checksums in a different direc
 .B \-f file
 Verify checksums in the sfv file
 .TP
-.B \-g path
-Go to the path name directory and verify checksums in the sfv file
+.B \-g file
+Change current directory to the path name of the file and verify checksums
+in the sfv.
 .TP
 .B \-i
 Ignore case in filenames. This is used in the checksum verification mode.
Index: src/readsfv.c
===================================================================
--- src/readsfv.c.orig
+++ src/readsfv.c
@@ -84,6 +84,18 @@ int readsfv(char *fn, char *dir, int arg
 	    fprintf(stderr, "cksfv: %s: %s\n", fn, strerror(errno));
 	return 1;
     }
+    if (fstat(fileno(fd), &st)) {
+	if (!TOTALLY_QUIET)
+	    fprintf(stderr, "cksfv: can not fstat %s: %s\n", fn, strerror(errno));
+	fclose(fd);
+	return 1;
+    }
+    if (S_ISDIR(st.st_mode)) {
+	if (!TOTALLY_QUIET)
+	    fprintf(stderr, "cksfv: %s: Is a directory\n", fn);
+	fclose(fd);
+	return 1;
+    }
 
     if (chdir(dir) != 0) {
 	if (!TOTALLY_QUIET)
openSUSE Build Service is sponsored by