import hdparm-9.54-2.el8

This commit is contained in:
CentOS Sources 2019-05-07 05:33:56 -04:00 committed by Andrew Lukoshko
commit 4f4c2c8036
8 changed files with 557 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
SOURCES/hdparm-9.54.tar.gz

1
.hdparm.metadata Normal file
View File

@ -0,0 +1 @@
54db6430645be2570e0fe4babd6d0ecfb765cc40 SOURCES/hdparm-9.54.tar.gz

View File

@ -0,0 +1,12 @@
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);

View File

@ -0,0 +1,47 @@
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));

View File

@ -0,0 +1,13 @@
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;
}
}

View File

@ -0,0 +1,81 @@
diff -urN hdparm-9.54/fibmap.c hdparm-9.54_patched/fibmap.c
--- hdparm-9.54/fibmap.c 2016-10-13 01:50:52.000000000 +0200
+++ hdparm-9.54_patched/fibmap.c 2018-10-04 12:17:39.630627349 +0200
@@ -232,6 +232,7 @@
if (fstat(fd, &st) == -1) {
err = errno;
perror(file_name);
+ close(fd);
return err;
}
if (!S_ISREG(st.st_mode)) {
diff -urN hdparm-9.54/fwdownload.c hdparm-9.54_patched/fwdownload.c
--- hdparm-9.54/fwdownload.c 2017-12-06 13:41:40.000000000 +0100
+++ hdparm-9.54_patched/fwdownload.c 2018-10-04 12:19:23.819336125 +0200
@@ -95,12 +95,19 @@
int xfer_min = 1, xfer_max = 0xffff, xfer_size;
ssize_t offset;
- if ((fwfd = open(fwpath, O_RDONLY)) == -1 || fstat(fwfd, &st) == -1) {
+ if ((fwfd = open(fwpath, O_RDONLY)) == -1) {
err = errno;
perror(fwpath);
return err;
}
+ if (fstat(fwfd, &st) == -1) {
+ err = errno;
+ perror(fwpath);
+ close(fwfd);
+ return err;
+ }
+
if (!S_ISREG(st.st_mode)) {
fprintf(stderr, "%s: not a regular file\n", fwpath);
err = EINVAL;
diff -urN hdparm-9.54/hdparm.c hdparm-9.54_patched/hdparm.c
--- hdparm-9.54/hdparm.c 2018-02-03 19:10:40.000000000 +0100
+++ hdparm-9.54_patched/hdparm.c 2018-10-04 13:25:58.924126976 +0200
@@ -590,6 +590,9 @@
printf("\n");
printf("\n * signifies the current active mode\n");
printf("\n");
+ free(fwrev);
+ free(model);
+ free(serno);
}
static const char *busstate_str (unsigned int value)
@@ -1174,8 +1177,10 @@
if (!shortened)
fdevname = strdup("the full disk");
- if (start_lba == 0ULL)
+ if (start_lba == 0ULL) {
+ free(fdevname);
return 0;
+ }
if (start_lba == START_LBA_UNKNOWN || fd_is_raid(fd)) {
fprintf(stderr, "%s is a RAID device: please specify an absolute LBA of a raw member device instead (raid1 only)\n", devname);
} else if (msg) {
@@ -1187,6 +1192,7 @@
fprintf(stderr, "The absolute LBA of sector %llu from %s should be %llu\n", lba, devname, start_lba + lba);
}
fprintf(stderr, "Aborting.\n");
+ free(fdevname);
exit(EINVAL);
}
diff -urN hdparm-9.54/sysfs.c hdparm-9.54_patched/sysfs.c
--- hdparm-9.54/sysfs.c 2018-10-04 12:14:29.900157666 +0200
+++ hdparm-9.54_patched/sysfs.c 2018-10-04 14:13:07.056659514 +0200
@@ -60,8 +63,8 @@
}
if (count < 0)
err = errno;
- fclose(fp);
}
+ fclose(fp);
if (err && verbose) perror(path);
*pathtail = '\0';
return err;

View File

@ -0,0 +1,24 @@
Index: hdparm-9.54/geom.c
===================================================================
--- hdparm-9.54.orig/geom.c
+++ hdparm-9.54/geom.c
@@ -18,6 +18,7 @@
#include <sys/ioctl.h>
#include <linux/types.h>
#include <linux/fs.h>
+#include <sys/sysmacros.h>
#include "hdparm.h"
Index: hdparm-9.54/sysfs.c
===================================================================
--- hdparm-9.54.orig/sysfs.c
+++ hdparm-9.54/sysfs.c
@@ -16,6 +16,7 @@
#include <limits.h>
#include <sys/stat.h>
#include <linux/types.h>
+#include <sys/sysmacros.h>
#include "hdparm.h"

378
SPECS/hdparm.spec Normal file
View File

@ -0,0 +1,378 @@
Summary: A utility for displaying and/or setting hard disk parameters
Name: hdparm
Version: 9.54
Release: 2%{?dist}
License: BSD
URL: http://sourceforge.net/projects/%{name}/
Source: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
Patch0: %{name}-9.43-ditch_dead_code.patch
Patch1: %{name}-9.43-close_fd.patch
Patch2: %{name}-9.43-get_geom.patch
Patch3: %{name}-9.54-sysmacros.patch
Patch4: %{name}-9.54-resourceleak-fixes.patch
%description
Hdparm is a useful system utility for setting (E)IDE hard drive
parameters. For example, hdparm can be used to tweak hard drive
performance and to spin down hard drives for power conservation.
%prep
%autosetup -p1
%build
CFLAGS="$RPM_OPT_FLAGS" %make_build STRIP=/bin/true LDFLAGS="$RPM_LD_FLAGS"
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/sbin
mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man8
install -c -m 755 hdparm $RPM_BUILD_ROOT/sbin/hdparm
install -c -m 644 hdparm.8 $RPM_BUILD_ROOT/%{_mandir}/man8
%files
%doc hdparm.lsm Changelog README.acoustic TODO
%license LICENSE.TXT
/sbin/hdparm
%{_mandir}/man8/hdparm.8*
%changelog
* Thu Oct 04 2018 Karsten Hopp <karsten@redhat.com> - 9.54-2
- fix resource leaks
* Thu Mar 15 2018 Michal Minář miminar@redhat.com - 9.54-1
- New upstream version 9.54
* Fri Feb 23 2018 Florian Weimer <fweimer@redhat.com> - 9.52-3
- Use LDFLAGS from redhat-rpm-config
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 9.52-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Mon Sep 11 2017 Michal Minar <miminar@redhat.com> - 9.52-1
- New upstream version.
* Sun Sep 10 2017 Vasiliy N. Glazov <vascom2@gmail.com> - 9.51-4
- Cleanup spec
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 9.51-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 9.51-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Sun Apr 23 2017 Michal Minar <miminar@redhat.com> 9.51-1
- New upstream version.
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 9.48-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 9.48-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Wed Jun 24 2015 Michal Minar <miminar@redhat.com> 9.48-1
- New upstream version.
* Tue Jun 16 2015 Michal Minar <miminar@redhat.com> 9.47-1
- New upstream version.
* Thu May 21 2015 Jaromir Capik <jcapik@redhat.com> - 9.45-2
- Removing ExcludeArch for s390 & s390x (it works)
* Tue Oct 28 2014 Michal Minar <miminar@redhat.com> 9.45-7
- New upstream version 9.45.
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 9.43-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 9.43-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Wed Aug 07 2013 Michal Minar <miminar@redhat.com> 9.43-5
- Fixed division by zero.
- Resolves: #986072
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 9.43-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Sun Jul 21 2013 Michal Minar <miminar@redhat.com> 9.43-3
- Added patches fixing covscan defects.
* Fri Apr 19 2013 Michal Minar <miminar@redhat.com> 9.43-2
- Fixed inconsistency between man page and program's help.
* Wed Mar 13 2013 Michal Minar <miminar@redhat.com> - 9.43-1
- hdparm-9.43
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 9.42-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Mon Oct 01 2012 Michal Minar <miminar@redhat.com> - 9.42-1
- hdparm-9.42
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 9.39-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Fri Feb 03 2012 Karsten Hopp <karsten@redhat.com> 9.39-1
- hdparm-9.39
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 9.36-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 9.36-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Mon Jan 24 2011 Karsten Hopp <karsten@redhat.com> 9.36-1
- update to hdparm-9.36 (#645048)
* Thu Oct 07 2010 Karsten Hopp <karsten@redhat.com> 9.33-1
- update to hdparm-9.33 (#592896)
* Fri Dec 11 2009 Karsten Hopp <karsten@redhat.com> 9.27-1
- update to 9.27
- enhance security-erase timeout to 12h (#536731)
* Thu Aug 20 2009 Ville Skyttä <ville.skytta@iki.fi> - 9.16-3
- Let rpmbuild strip the executable (#513025).
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 9.16-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Fri Jul 17 2009 Karsten Hopp <karsten@redhat.com> 9.16-1
- update to 9.16, fixes disk spindowns
* Wed Mar 04 2009 Karsten Hopp <karsten@redhat.com> 9.12-1
- update to 9.12 to fix #488560
* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 9.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Wed Jan 14 2009 Karsten Hopp <karsten@redhat.com> 9.8-1
- update
* Wed Mar 05 2008 Karsten Hopp <karsten@redhat.com> 8.6-1
- update to 8.6
- fix source URL
* Mon Feb 25 2008 Karsten Hopp <karsten@redhat.com> 8.5-1
- version 8.5, fixes u8->u16 bug in security commands
* Mon Feb 25 2008 Karsten Hopp <karsten@redhat.com> 8.4-2
- fix debuginfo package (#434644)
* Wed Feb 20 2008 Karsten Hopp <karsten@redhat.com> 8.4-1
- version 8.4
* Tue Feb 19 2008 Karsten Hopp <karsten@redhat.com> 8.1-3
- upload 8.1 sources and rebuild
* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 8.1-2
- Autorebuild for GCC 4.3
* Mon Feb 18 2008 Karsten Hopp <karsten@redhat.com> 8.1-1
- update to 8.1
* Fri Aug 24 2007 Karsten Hopp <karsten@redhat.com> 7.7-1
- update to 7.7
* Tue Jul 10 2007 Karsten Hopp <karsten@redhat.com> 7.6-1
- update to version 7.6
* Fri Feb 09 2007 Karsten Hopp <karsten@redhat.com> 6.9-3
- more review cleanups (#225882)
* Mon Feb 05 2007 Karsten Hopp <karsten@redhat.com> 6.9-2
- clean up spec file for merge review (#225882)
* Thu Jan 18 2007 Karsten Hopp <karsten@redhat.com> 6.9-1
- update to 6.9
* Mon Jul 17 2006 Karsten Hopp <karsten@redhat.de> 6.6-2
- test builds on ia64, ppc, ppc64
* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 6.6-1.1
- rebuild
* Mon May 22 2006 Karsten Hopp <karsten@redhat.de> 6.3-3
- remove obsolute include patch
- disable idestruct patch, rebuild
* Fri Feb 10 2006 Jesse Keating <jkeating@redhat.com> - 6.3-2.2
- bump again for double-long bug on ppc(64)
* Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com> - 6.3-2.1
- rebuilt for new gcc4.1 snapshot and glibc changes
* Tue Dec 20 2005 Karsten Hopp <karsten@redhat.de> 6.3-2
- use ExcludeArch, this allows building on archs we don't
ship such as Alpha (#175919)
* Fri Dec 09 2005 Jesse Keating <jkeating@redhat.com>
- rebuilt
* Wed Nov 30 2005 Karsten Hopp <karsten@redhat.de> 6.3-1
- fix package URL
* Tue Oct 25 2005 Karsten Hopp <karsten@redhat.de> 6.3-1
- update to hdparm-6.3
* Wed Jun 08 2005 Karsten Hopp <karsten@redhat.de> 6.1-1
- update to 6.1 (BLKGETSIZE fixes)
- work around hdparm's usage of kernel headers, assume
that we run it on little-endian machines only
* Wed May 18 2005 Karsten Hopp <karsten@redhat.de> 5.9-3
- remove /etc/sysconfig/harddisks (#157673)
* Tue May 10 2005 Karsten Hopp <karsten@redhat.de> 5.9-2
- enable debuginfo
* Wed Mar 02 2005 Karsten Hopp <karsten@redhat.de> 5.9-1
- update to 5.9
- build with gcc-4
* Mon Jan 03 2005 Karsten Hopp <karsten@redhat.de> 5.8-2
- add --help option (#143916)
* Fri Nov 26 2004 Karsten Hopp <karsten@redhat.de> 5.8-1
- update
* Tue Sep 21 2004 Than Ngo <than@redhat.com> 5.7-2
- rebuilt
* Mon Sep 06 2004 Karsten Hopp <karsten@redhat.de> 5.7-1
- update to latest stable version
* Tue Jun 15 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt
* Thu Feb 19 2004 Karsten Hopp <karsten@redhat.de> 5.5-1
- update to latest stable version
- rename variable to avoid name clash with readahead function
* Fri Feb 13 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt
* Wed Jun 04 2003 Elliot Lee <sopwith@redhat.com>
- rebuilt
* Wed Jun 04 2003 Karsten Hopp <karsten@redhat.de> 5.4-2
- rebuild
* Wed Jun 04 2003 Karsten Hopp <karsten@redhat.de> 5.4-1
- update
- #92057
* Wed Apr 23 2003 Karsten Hopp <karsten@redhat.de> 5.3-2
- rebuild
* Wed Apr 23 2003 Karsten Hopp <karsten@redhat.de> 5.3-1
- update to 5.3
- add comment to /etc/sysconfig/harddisks
* Wed Jan 22 2003 Tim Powers <timp@redhat.com>
- rebuilt
* Thu Dec 12 2002 Tim Powers <timp@redhat.com> 5.2-3
- rebuild on all arches
* Tue Nov 19 2002 Tim Powers <timp@redhat.com>
- rebuild on all arches
* Wed Jun 26 2002 Karsten Hopp <karsten@redhat.de>
- update to 5.2 with the following fixes:
- v5.2 compile fixes for 2.5.xx
- v5.1 fixed segfault in "-i" on older drives
- v5.0 lots of updates and new features
- v4.9 fixed compile error with 2.5.xx kernels
- v4.8 changed -Q to allow specifying queue depth
- v4.7 added -z, -Q, -M flags; expanded parm range for -p
* Fri Jun 21 2002 Tim Powers <timp@redhat.com>
- automated rebuild
* Thu May 23 2002 Tim Powers <timp@redhat.com>
- automated rebuild
* Fri Feb 22 2002 Karsten Hopp <karsten@redhat.de>
- bump version for 8.0
* Fri Feb 22 2002 Karsten Hopp <karsten@redhat.de>
- rebuild in new environment
* Wed Jan 23 2002 Karsten Hopp <karsten@redhat.de> (4.6-1)
- Update to 4.6
* Mon Oct 01 2001 Karsten Hopp <karsten@redhat.de>
- fix name of doc file (#54137)
* Fri Jul 20 2001 Florian La Roche <Florian.LaRoche@redhat.de>
- exclude s390,s390x
* Mon Jun 25 2001 Karsten Hopp <karsten@redhat.de>
- update to version 4.1
- update URL
* Wed Jul 19 2000 Bernhard Rosenkränzer <bero@redhat.com>
- disable readahead (#14268)
- add comment in /etc/sysconfig/harddisks about possible extra parameters
* Thu Jul 13 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild
* Wed Jul 12 2000 Trond Eivind Glomsrød <teg@redhat.com>
- disable 32 bit interfacing (#13730)
* Tue Jun 27 2000 Trond Eivind Glomsrød <teg@redhat.com>
- use %%{_tmppath}
- add /etc/sysconfig/harddisks, a new file for hardisk
optimization parameters
* Mon Jun 19 2000 Bernhard Rosenkränzer <bero@redhat.com>
- FHSify
* Sun Apr 9 2000 Bernhard Rosenkränzer <bero@redhat.com>
- Fix compilation with kernel 2.3.*
* Thu Feb 17 2000 Bernhard Rosenkränzer <bero@redhat.com>
- 3.9
- handle RPM_OPT_FLAGS
* Thu Feb 17 2000 Bernhard Rosenkränzer <bero@redhat.com>
- Use O_NONBLOCK when opening devices so we can manipulate CD-ROM drives
with no media inserted, even when running a current kernel (Bug #6457)
* Sat Feb 5 2000 Bill Nottingham <notting@redhat.com>
- build as non-root user (#6458)
* Fri Feb 4 2000 Bernhard Rosenkränzer <bero@redhat.com>
- deal with RPM compressing man pages
* Fri Nov 19 1999 Bernhard Rosenkraenzer <bero@redhat.com>
- 3.6
* Thu Aug 12 1999 Cristian Gafton <gafton@redhat.com>
- version 3.5
* Wed Mar 24 1999 Cristian Gafton <gafton@redhat.com>
- added patches from UP
* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com>
- auto rebuild in the new build environment (release 4)
* Tue Dec 29 1998 Cristian Gafton <gafton@redhat.com>
- build for 6.0
* Fri Apr 24 1998 Prospector System <bugs@redhat.com>
- translations modified for de, fr, tr
* Wed Apr 08 1998 Erik Troan <ewt@redhat.com>
- updated to 3.3
- build rooted
* Fri Oct 31 1997 Donnie Barnes <djb@redhat.com>
- fixed spelling error in summary
* Mon Jun 02 1997 Erik Troan <ewt@redhat.com>
- built against glibc