Print directory name on create errors.
authorAndre Noll <maan@systemlinux.org>
Mon, 5 Aug 2013 10:46:39 +0000 (12:46 +0200)
committerAndre Noll <maan@systemlinux.org>
Mon, 5 Aug 2013 10:49:39 +0000 (12:49 +0200)
In create mode, if the database directory already exists, adu prints
an error message of the form

main: directory exists.

This is a bit sparse, so let's add a log message which prints the
directory name. With the patch applied the output becomes

open_dir_table: could not create /ebio/maan/tmp/adu-lists/
main: directory exists

adu.c

diff --git a/adu.c b/adu.c
index 6d4780e3bff9937eea053413ca6db82f2b14bd76..0cd1644c236c17908656eb25c24c12084b7c9967 100644 (file)
--- a/adu.c
+++ b/adu.c
@@ -208,8 +208,10 @@ int open_dir_table(int create)
                        goto out;
                NOTICE_LOG("creating dir table\n");
                ret = osl(osl_create_table(&dir_table_desc));
                        goto out;
                NOTICE_LOG("creating dir table\n");
                ret = osl(osl_create_table(&dir_table_desc));
-               if (ret < 0)
+               if (ret < 0) {
+                       ERROR_LOG("could not create %s\n", dir_table_desc.dir);
                        goto out;
                        goto out;
+               }
        }
        INFO_LOG("opening dir table\n");
        return osl(osl_open_table(&dir_table_desc, &dir_table));
        }
        INFO_LOG("opening dir table\n");
        return osl(osl_open_table(&dir_table_desc, &dir_table));