aboutsummaryrefslogtreecommitdiffstats
path: root/src/restricted-hdparm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/restricted-hdparm.c')
-rw-r--r--src/restricted-hdparm.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/restricted-hdparm.c b/src/restricted-hdparm.c
index 2b2e0f0..4c8bc3b 100644
--- a/src/restricted-hdparm.c
+++ b/src/restricted-hdparm.c
@@ -22,10 +22,16 @@
int main(int argc, char** argv)
{
- char* act = argv[1];
+ char* act;
int i;
- setuid(0);
+ if (argc < 2)
+ return 1;
+
+ if (setuid(0))
+ perror(*argv);
+
+ act = argv[1];
for (i = 2; i < argc; i++)
if (argv[i][0] == '/')