From e1e5b5fd7fc277a355a90ae0840965afdba4b16a Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 19 Feb 2014 10:59:35 +0100 Subject: Add some more args and revert division by zero. --- main_complete.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'main_complete.c') diff --git a/main_complete.c b/main_complete.c index a79dbc5..a649078 100644 --- a/main_complete.c +++ b/main_complete.c @@ -63,8 +63,8 @@ int main(int argc, char *argv[]) INFO(example, "We are up and running"); DEBUG(example, "Or are we %d?", 42); - int a = 0; - DEBUG(foo, "Or are we %d?", 1/a); + + DEBUG(foo, "Or are we %d?", 42); hug_close(); -- cgit v1.2.3 From f8dc9ad4c41c7ec781c180d327f11ba78801263d Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 19 Feb 2014 11:04:30 +0100 Subject: Add debug output. --- main_complete.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'main_complete.c') diff --git a/main_complete.c b/main_complete.c index a649078..b86e2a1 100644 --- a/main_complete.c +++ b/main_complete.c @@ -35,6 +35,8 @@ int main(int argc, char *argv[]) { + printf("Running...\n"); + int fd = open("/tmp/my.log", O_CREAT | O_RDWR, 0777); if(fd == -1) { return 1; @@ -68,5 +70,7 @@ int main(int argc, char *argv[]) hug_close(); + printf("done\n"); + return 0; } -- cgit v1.2.3 From 7f8952630abc0db42aa29cc0f2df4481789433bc Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 19 Feb 2014 11:11:49 +0100 Subject: Add error handling and unlink of created tmp files. --- main_complete.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'main_complete.c') 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 #include #include - +#include #include +#include +#include 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; } -- cgit v1.2.3