commit
fb51eb91f2
@ -1,47 +0,0 @@
|
||||
Index: hdparm-9.43/sgio.c
|
||||
===================================================================
|
||||
--- hdparm-9.43.orig/sgio.c
|
||||
+++ hdparm-9.43/sgio.c
|
||||
@@ -17,6 +17,10 @@
|
||||
|
||||
#include <linux/hdreg.h>
|
||||
|
||||
+#ifndef DEMAND_SENSE_DATA
|
||||
+ #define DEMAND_SENSE_DATA 0
|
||||
+#endif
|
||||
+
|
||||
extern int verbose;
|
||||
extern int prefer_ata12;
|
||||
|
||||
@@ -193,7 +197,7 @@ int sg16 (int fd, int rw, int dma, struc
|
||||
unsigned char cdb[SG_ATA_16_LEN];
|
||||
unsigned char sb[32], *desc;
|
||||
struct scsi_sg_io_hdr io_hdr;
|
||||
- int prefer12 = prefer_ata12, demanded_sense = 0;
|
||||
+ int prefer12 = prefer_ata12;
|
||||
|
||||
if (tf->command == ATA_OP_PIDENTIFY)
|
||||
prefer12 = 0;
|
||||
@@ -302,14 +306,16 @@ int sg16 (int fd, int rw, int dma, struc
|
||||
|
||||
desc = sb + 8;
|
||||
if (io_hdr.driver_status != SG_DRIVER_SENSE) {
|
||||
- if (sb[0] | sb[1] | sb[2] | sb[3] | sb[4] | sb[5] | sb[6] | sb[7] | sb[8] | sb[9]) {
|
||||
- static int second_try = 0;
|
||||
- if (!second_try++)
|
||||
+ static int second_try = 0;
|
||||
+ if (!second_try++) {
|
||||
+ if (sb[0] | sb[1] | sb[2] | sb[3] | sb[4] | sb[5] | sb[6] | sb[7] | sb[8] | sb[9]) {
|
||||
fprintf(stderr, "SG_IO: questionable sense data, results may be incorrect\n");
|
||||
- } else if (demanded_sense) {
|
||||
- static int second_try = 0;
|
||||
- if (!second_try++)
|
||||
+ }
|
||||
+#if DEMAND_SENSE_DATA
|
||||
+ else {
|
||||
fprintf(stderr, "SG_IO: missing sense data, results may be incorrect\n");
|
||||
+ }
|
||||
+#endif
|
||||
}
|
||||
} else if (sb[0] != 0x72 || sb[7] < 14 || desc[0] != 0x09 || desc[1] < 0x0c) {
|
||||
dump_bytes("SG_IO: bad/missing sense data, sb[]", sb, sizeof(sb));
|
||||
@ -1,12 +0,0 @@
|
||||
Index: hdparm-9.43/fallocate.c
|
||||
===================================================================
|
||||
--- hdparm-9.43.orig/fallocate.c
|
||||
+++ hdparm-9.43/fallocate.c
|
||||
@@ -41,6 +41,7 @@ int do_fallocate_syscall (const char *pa
|
||||
exit(0);
|
||||
}
|
||||
err = errno;
|
||||
+ close(fd);
|
||||
unlink(path);
|
||||
}
|
||||
perror(path);
|
||||
@ -1,13 +0,0 @@
|
||||
Index: hdparm-9.43/geom.c
|
||||
===================================================================
|
||||
--- hdparm-9.43.orig/geom.c
|
||||
+++ hdparm-9.43/geom.c
|
||||
@@ -201,7 +201,7 @@ int get_dev_geometry (int fd, __u32 *cyl
|
||||
__u64 hs = (*heads) * (*sects);
|
||||
__u64 cyl = (*cyls);
|
||||
__u64 chs = cyl * hs;
|
||||
- if (chs < (*nsectors))
|
||||
+ if (chs < (*nsectors) && hs)
|
||||
*cyls = (*nsectors) / hs;
|
||||
}
|
||||
}
|
||||
16
9000-hdparm-fallocate-close-fd.patch
Normal file
16
9000-hdparm-fallocate-close-fd.patch
Normal file
@ -0,0 +1,16 @@
|
||||
diff --git a/fallocate.c b/fallocate.c
|
||||
index 4e60459..d73c0f9 100644
|
||||
--- a/fallocate.c
|
||||
+++ b/fallocate.c
|
||||
@@ -39,9 +39,11 @@ int do_fallocate_syscall (const char *path, __u64 bytecount)
|
||||
err = syscall(SYS_fallocate, fd, mode, offset, len);
|
||||
if (err >= 0) {
|
||||
fsync(fd);
|
||||
+ close(fd);
|
||||
exit(0);
|
||||
}
|
||||
err = errno;
|
||||
+ close(fd);
|
||||
unlink(path);
|
||||
}
|
||||
perror(path);
|
||||
16
hdparm.spec
16
hdparm.spec
@ -1,13 +1,11 @@
|
||||
Name: hdparm
|
||||
Version: 9.56
|
||||
Release: 3
|
||||
Release: 4
|
||||
Summary: A system utility for setting or showing hard drive parameters
|
||||
License: BSD
|
||||
URL: https://sourceforge.net/projects/%{name}/
|
||||
Source: https://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
|
||||
Patch0000: 0000-hdparm-9.43-ditch_dead_code.patch
|
||||
Patch0001: 0001-hdparm-9.43-close_fd.patch
|
||||
Patch0002: 0002-hdparm-9.43-get_geom.patch
|
||||
Source0: https://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
|
||||
Patch9000: 9000-hdparm-fallocate-close-fd.patch
|
||||
|
||||
BuildRequires: gcc git
|
||||
|
||||
@ -44,11 +42,17 @@ install -c -m 644 hdparm.8 $RPM_BUILD_ROOT/%{_mandir}/man8
|
||||
%{_mandir}/man8/hdparm.8*
|
||||
|
||||
%changelog
|
||||
* Tue Jan 7 2020 openEuler Buildteam <buildteam@openeuler.org> - 9.56-4
|
||||
- Type:enhancement
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:Update package
|
||||
|
||||
* Fri Aug 30 2019 louhongxiang <louhongxiang@huawei.com> - 9.56-3
|
||||
- Type:enhancemnet
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESCi:openEuler Debranding
|
||||
- DESC:openEuler Debranding
|
||||
|
||||
* Wed Aug 21 2019 wubo <wubo40@huawei.com> - 9.56-2
|
||||
- Package init and change patch name
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user