diff options
author | Christophe Grenier <[email protected]> | 2013-11-01 13:38:55 +0100 |
---|---|---|
committer | Christophe Grenier <[email protected]> | 2013-11-01 13:38:55 +0100 |
commit | 0bf23249bb4ea2bf930148bfd59a13342cdedd76 (patch) | |
tree | 2861622335385e46991247708173aaebd1467792 /src/testdisk.c | |
parent | 7172224ac4cbe9f4c40db5df505cfe8725108e53 (diff) |
"testdisk -lu" now displays a warning if no disk is found.
Diffstat (limited to 'src/testdisk.c')
-rw-r--r-- | src/testdisk.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/testdisk.c b/src/testdisk.c index 9ab70175..dde8a312 100644 --- a/src/testdisk.c +++ b/src/testdisk.c @@ -260,6 +260,21 @@ int main( int argc, char **argv ) /* Scan for available device only if no device or image has been supplied in parameter */ if(list_disk==NULL) list_disk=hd_parse(list_disk, verbose, testdisk_mode); + if(list_disk==NULL) + { + printf("No disk detected.\n"); +#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(DJGPP) +#else +#ifdef HAVE_GETEUID + if(geteuid()!=0) + { + printf("You need to be root to use TestDisk.\n"); + } +#endif +#endif + return 1; + } + /* Activate the cache */ for(element_disk=list_disk;element_disk!=NULL;element_disk=element_disk->next) element_disk->disk=new_diskcache(element_disk->disk,testdisk_mode); |