aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-11-27 06:53:47 +0100
committerMattias Andrée <maandree@operamail.com>2015-11-27 06:53:47 +0100
commit7a609401b7b1eb53e35c3203c28c233d0b4a00cc (patch)
tree1600954da8181ea90ea5a640aac0d623f4856a67
parentinfo (diff)
downloadxpybar-7a609401b7b1eb53e35c3203c28c233d0b4a00cc.tar.gz
xpybar-7a609401b7b1eb53e35c3203c28c233d0b4a00cc.tar.bz2
xpybar-7a609401b7b1eb53e35c3203c28c233d0b4a00cc.tar.xz
restricted-hdparm: sanity check argc, and report failure of setuid
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-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] == '/')