Browse Source

Merge commit '6f45c8b' into bfgminer-3.0.x

Luke Dashjr 13 years ago
parent
commit
d74e0ac2d3
1 changed files with 6 additions and 1 deletions
  1. 6 1
      fpgautils.c

+ 6 - 1
fpgautils.c

@@ -180,6 +180,7 @@ int _serial_autodetect_sysfs(detectone_func_t detectone, va_list needles)
 	char devpath[sizeof(devroot) + (NAME_MAX * 3)];
 	char buf[0x100];
 	char *devfile, *upfile;
+	char *rs;
 	char found = 0;
 	size_t len, len2;
 	
@@ -196,7 +197,11 @@ int _serial_autodetect_sysfs(detectone_func_t detectone, va_list needles)
 		devfile = upfile + len;
 		strcpy(devfile, "/product");
 		F = fopen(devpath, "r");
-		if (!(F && fgets(buf, sizeof(buf), F)))
+		if (!F)
+			continue;
+		rs = fgets(buf, sizeof(buf), F);
+		fclose(F);
+		if (!rs)
 			continue;
 		
 		if (!SEARCH_NEEDLES(buf))