summaryrefslogtreecommitdiff
path: root/main_complete.c
diff options
context:
space:
mode:
Diffstat (limited to 'main_complete.c')
-rw-r--r--main_complete.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/main_complete.c b/main_complete.c
index b86e2a1..8eb4b7e 100644
--- a/main_complete.c
+++ b/main_complete.c
@@ -30,15 +30,17 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-
+#include <errno.h>
#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
int main(int argc, char *argv[])
{
- printf("Running...\n");
-
- int fd = open("/tmp/my.log", O_CREAT | O_RDWR, 0777);
+ const char *mylog = "/tmp/my.log";
+ int fd = open(mylog, O_CREAT | O_RDWR, 0777);
if(fd == -1) {
+ printf("Could not open '%s' for writing: %s", mylog, strerror(errno));
return 1;
}
hug_status_t status = hug_init(HUG_FLAG_USE_MUTEX |
@@ -70,7 +72,8 @@ int main(int argc, char *argv[])
hug_close();
- printf("done\n");
+ unlink(mylog);
+ unlink("/tmp/my.log2");
return 0;
}