diff options
Diffstat (limited to 'meta-openembedded/meta-oe/recipes-support/hddtemp/hddtemp/hddtemp-0.3-beta15-autodetect-717479.patch')
-rw-r--r-- | meta-openembedded/meta-oe/recipes-support/hddtemp/hddtemp/hddtemp-0.3-beta15-autodetect-717479.patch | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/meta-openembedded/meta-oe/recipes-support/hddtemp/hddtemp/hddtemp-0.3-beta15-autodetect-717479.patch b/meta-openembedded/meta-oe/recipes-support/hddtemp/hddtemp/hddtemp-0.3-beta15-autodetect-717479.patch new file mode 100644 index 000000000..1ec6a61b3 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-support/hddtemp/hddtemp/hddtemp-0.3-beta15-autodetect-717479.patch @@ -0,0 +1,92 @@ +Auto-detect disks if none specified + +Refer to: +https://bugzilla.redhat.com/show_bug.cgi?id=717479 + +Index: hddtemp-0.3-beta15/doc/hddtemp.8 +=================================================================== +--- hddtemp-0.3-beta15.orig/doc/hddtemp.8 ++++ hddtemp-0.3-beta15/doc/hddtemp.8 +@@ -19,7 +19,7 @@ + hddtemp \- Utility to monitor hard drive temperature + .SH SYNOPSIS + .B hddtemp +-.RI [ options ] " [type:]disk" ... ++.RI [ options ] " [[type:]disk]" ... + .SH "DESCRIPTION" + .PP + .B hddtemp +@@ -35,7 +35,8 @@ You can specify one or more device drive + with a + .B type + like PATA, SATA or SCSI to force hddtemp too use one of these type +-(because detection can fail). ++(because detection can fail). If no paths are specified, autodetection of ++installed drives is attempted. + + + .SH "OPTIONS" +Index: hddtemp-0.3-beta15/src/hddtemp.c +=================================================================== +--- hddtemp-0.3-beta15.orig/src/hddtemp.c ++++ hddtemp-0.3-beta15/src/hddtemp.c +@@ -54,6 +54,7 @@ + #include <linux/hdreg.h> + #include <ctype.h> + #include <assert.h> ++#include <glob.h> + + // Application specific includes + #include "ata.h" +@@ -255,6 +256,7 @@ int main(int argc, char* argv[]) { + int ret = 0; + int show_db; + struct disk * ldisks; ++ glob_t diskglob; + + backtrace_sigsegv(); + backtrace_sigill(); +@@ -423,11 +425,6 @@ int main(int argc, char* argv[]) { + exit(0); + } + +- if(argc - optind <= 0) { +- fprintf(stderr, _("Too few arguments: you must specify one drive, at least.\n")); +- exit(1); +- } +- + if(debug) { + /* argc = optind + 1;*/ + quiet = 1; +@@ -438,6 +435,23 @@ int main(int argc, char* argv[]) { + exit(1); + } + ++ memset(&diskglob, 0, sizeof(glob_t)); ++ if(argc - optind <= 0) { ++ if(glob("/dev/[hs]d[a-z]", 0, NULL, &diskglob) == 0) { ++ argc = diskglob.gl_pathc; ++ argv = diskglob.gl_pathv; ++ optind = 0; ++ } else { ++ argc = 0; ++ } ++ } ++ ++ if(argc - optind <= 0) { ++ globfree(&diskglob); ++ fprintf(stderr, _("Too few arguments: you must specify one drive, at least.\n")); ++ exit(1); ++ } ++ + init_bus_types(); + + /* collect disks informations */ +@@ -531,6 +545,7 @@ int main(int argc, char* argv[]) { + else { + do_direct_mode(ldisks); + } ++ globfree(&diskglob); + + return ret; + } |