aboutsummaryrefslogtreecommitdiffstats
path: root/handerror.c
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2020-10-21 19:26:03 +0000
committerJoursoir <chat@joursoir.net>2020-10-21 19:26:03 +0000
commit5a8218b13fbe21e4c85a484933ca201b666323ee (patch)
tree2f834cd5eefe529c9e569c0cbafa2c0c653386ed /handerror.c
parent8af0737920cceb1d29bbd4ac6cf7b692c1ad1416 (diff)
downloadlock-password-5a8218b13fbe21e4c85a484933ca201b666323ee.tar.gz
lock-password-5a8218b13fbe21e4c85a484933ca201b666323ee.tar.bz2
lock-password-5a8218b13fbe21e4c85a484933ca201b666323ee.zip
fix bug: work outside working dir; refactor
Diffstat (limited to 'handerror.c')
-rw-r--r--handerror.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/handerror.c b/handerror.c
index 753e834..35e8f28 100644
--- a/handerror.c
+++ b/handerror.c
@@ -1,5 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
+#include <sys/wait.h>
void callError(int num)
{
@@ -13,3 +15,16 @@ void printError(char *text)
exit(4);
}
+void easyFork(char *name, char *arguments[])
+{
+ int pid;
+ pid = fork();
+ if(pid == -1) callError(100);
+ if(pid == 0) { /* new process */
+ execvp(name, arguments);
+ perror(name);
+ exit(4);
+ }
+ wait(&pid);
+}
+