Error out if the path or cmd is invalid - smdev - suckless mdev | |
git clone git://git.suckless.org/smdev | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 74d551415ca2b21d5b7d657b89466975c8f492a4 | |
parent 77c9b9042ba0f9f0c2fff715dbac21535bcea202 | |
Author: sin <[email protected]> | |
Date: Wed, 21 Aug 2013 16:44:20 +0100 | |
Error out if the path or cmd is invalid | |
Diffstat: | |
M smdev.c | 5 ++++- | |
1 file changed, 4 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/smdev.c b/smdev.c | |
@@ -105,6 +105,8 @@ create_dev(const char *path) | |
continue; | |
if (Rule->path) { | |
+ if (Rule->path[0] != '=' && Rule->path[0] != '>') | |
+ eprintf("Invalid path '%s'\n", Rule->path); | |
if (Rule->path[strlen(Rule->path) - 1] == '/') { | |
umask(022); | |
if (mkpath(&Rule->path[1], 0755) < 0) | |
@@ -152,10 +154,11 @@ create_dev(const char *path) | |
break; | |
case '$': | |
case '*': | |
- default: | |
fprintf(stderr, "Unsupported command '%s' for … | |
Rule->cmd, Rule->devregex); | |
break; | |
+ default: | |
+ eprintf("Invalid command '%s'\n", Rule->cmd); | |
} | |
} | |