summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/hddtemp/files/hddtemp-0.3-beta15-autodetect-717479.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-oe/recipes-support/hddtemp/files/hddtemp-0.3-beta15-autodetect-717479.patch')
-rw-r--r--meta-oe/recipes-support/hddtemp/files/hddtemp-0.3-beta15-autodetect-717479.patch90
1 files changed, 90 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/hddtemp/files/hddtemp-0.3-beta15-autodetect-717479.patch b/meta-oe/recipes-support/hddtemp/files/hddtemp-0.3-beta15-autodetect-717479.patch
new file mode 100644
index 000000000..19f8380b4
--- /dev/null
+++ b/meta-oe/recipes-support/hddtemp/files/hddtemp-0.3-beta15-autodetect-717479.patch
@@ -0,0 +1,90 @@
1Auto-detect disks if none specified
2
3Refer to:
4https://bugzilla.redhat.com/show_bug.cgi?id=717479
5
6diff -up hddtemp-0.3-beta15/doc/hddtemp.8~ hddtemp-0.3-beta15/doc/hddtemp.8
7--- hddtemp-0.3-beta15/doc/hddtemp.8~ 2011-08-18 00:36:05.689001470 +0300
8+++ hddtemp-0.3-beta15/doc/hddtemp.8 2011-08-18 00:44:46.753006253 +0300
9@@ -19,7 +19,7 @@
10 hddtemp \- Utility to monitor hard drive temperature
11 .SH SYNOPSIS
12 .B hddtemp
13-.RI [ options ] " [type:]disk" ...
14+.RI [ options ] " [[type:]disk]" ...
15 .SH "DESCRIPTION"
16 .PP
17 .B hddtemp
18@@ -35,7 +35,8 @@ You can specify one or more device drive
19 with a
20 .B type
21 like PATA, SATA or SCSI to force hddtemp too use one of these type
22-(because detection can fail).
23+(because detection can fail). If no paths are specified, autodetection of
24+installed drives is attempted.
25
26
27 .SH "OPTIONS"
28diff -up hddtemp-0.3-beta15/src/hddtemp.c~ hddtemp-0.3-beta15/src/hddtemp.c
29--- hddtemp-0.3-beta15/src/hddtemp.c~ 2011-08-18 00:36:05.638996861 +0300
30+++ hddtemp-0.3-beta15/src/hddtemp.c 2011-08-18 00:35:55.485060798 +0300
31@@ -54,6 +54,7 @@
32 #include <linux/hdreg.h>
33 #include <ctype.h>
34 #include <assert.h>
35+#include <glob.h>
36
37 // Application specific includes
38 #include "ata.h"
39@@ -255,6 +256,7 @@ int main(int argc, char* argv[]) {
40 int ret = 0;
41 int show_db;
42 struct disk * ldisks;
43+ glob_t diskglob;
44
45 backtrace_sigsegv();
46 backtrace_sigill();
47@@ -419,11 +421,6 @@ int main(int argc, char* argv[]) {
48 exit(0);
49 }
50
51- if(argc - optind <= 0) {
52- fprintf(stderr, _("Too few arguments: you must specify one drive, at least.\n"));
53- exit(1);
54- }
55-
56 if(debug) {
57 /* argc = optind + 1;*/
58 quiet = 1;
59@@ -434,6 +431,23 @@ int main(int argc, char* argv[]) {
60 exit(1);
61 }
62
63+ memset(&diskglob, 0, sizeof(glob_t));
64+ if(argc - optind <= 0) {
65+ if(glob("/dev/[hs]d[a-z]", 0, NULL, &diskglob) == 0) {
66+ argc = diskglob.gl_pathc;
67+ argv = diskglob.gl_pathv;
68+ optind = 0;
69+ } else {
70+ argc = 0;
71+ }
72+ }
73+
74+ if(argc - optind <= 0) {
75+ globfree(&diskglob);
76+ fprintf(stderr, _("Too few arguments: you must specify one drive, at least.\n"));
77+ exit(1);
78+ }
79+
80 init_bus_types();
81
82 /* collect disks informations */
83@@ -527,6 +541,7 @@ int main(int argc, char* argv[]) {
84 else {
85 do_direct_mode(ldisks);
86 }
87+ globfree(&diskglob);
88
89 return ret;
90 }