]> git.tuebingen.mpg.de Git - adu.git/blobdiff - adu.c
Add new logo.
[adu.git] / adu.c
diff --git a/adu.c b/adu.c
index 6d4780e3bff9937eea053413ca6db82f2b14bd76..7d133d619836e3340e5bce2f6b2b3bf83b39d789 100644 (file)
--- a/adu.c
+++ b/adu.c
@@ -125,6 +125,25 @@ __printf_2_3 void __log(int ll, const char* fmt,...)
        va_end(argp);
 }
 
+/**
+ * adu's version of strerror(3).
+ *
+ * \param num The error number.
+ *
+ * \return The error text of \a num.
+ */
+const char *adu_strerror(int num)
+{
+       assert(num > 0);
+       if (num == E_OSL) {
+               assert(osl_errno > 0);
+               return osl_strerror((osl_errno));
+       }
+       if (IS_SYSTEM_ERROR(num))
+               return strerror((num) & ((1 << SYSTEM_ERROR_BIT) - 1));
+       return adu_errlist[num];
+}
+
 static void close_dir_table(void)
 {
        int ret;
@@ -208,8 +227,10 @@ int open_dir_table(int create)
                        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;
+               }
        }
        INFO_LOG("opening dir table\n");
        return osl(osl_open_table(&dir_table_desc, &dir_table));