1ce45d3
diff -up hdparm-9.60/sysfs.c.bak hdparm-9.60/sysfs.c
1ce45d3
--- hdparm-9.60/sysfs.c.bak	2021-04-15 15:48:56.806354847 +0200
1ce45d3
+++ hdparm-9.60/sysfs.c	2021-04-16 14:44:42.520395436 +0200
1ce45d3
@@ -61,7 +61,8 @@ static int sysfs_write_attr (char *path,
1ce45d3
 		if (count < 0)
1ce45d3
 			err = errno;
1ce45d3
 	}
1ce45d3
-	fclose(fp);
1ce45d3
+	if (fp)
1ce45d3
+		fclose(fp);
1ce45d3
 	if (err && verbose) perror(path);
1ce45d3
 	*pathtail = '\0';
1ce45d3
 	return err;