]> git.tue.mpg.de Git - osl.git/commitdiff
osl_open_table(): Remove pointless directory check.
authorAndre Noll <maan@tuebingen.mpg.de>
Wed, 19 Apr 2017 10:59:54 +0000 (12:59 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Wed, 17 Jun 2020 20:30:31 +0000 (22:30 +0200)
The subsequent mmap(2) call will fail if the directory does not exist
(or if the path is not a directory), so this check is not needed.

This removes the only user of the E_OSL_NOTDIR error code. We must
keep it in the errlist file though, because error codes must be
considered part of the API.

osl.c

diff --git a/osl.c b/osl.c
index c5f70ffa1af9bfa5f57c29f5c3ee4a8ce2462b98..5f58488c0f3e342e7c413c743a1fc85cedc0294b 100644 (file)
--- a/osl.c
+++ b/osl.c
@@ -1070,30 +1070,13 @@ int init_rbtrees(struct osl_table *t)
 __export int osl_open_table(const struct osl_table_description *table_desc,
                struct osl_table **result)
 {
-       int i, ret;
+       int ret;
        struct osl_table *t;
-       const struct osl_column_description *cd;
 
        NOTICE_LOG("opening table %s\n", table_desc->name);
        ret = init_table_structure(table_desc, &t);
        if (ret < 0)
                return ret;
-       FOR_EACH_DISK_STORAGE_COLUMN(i, t, cd) {
-               struct stat statbuf;
-               char *dirname = column_filename(t, i);
-
-               ret = -E_OSL_NOMEM;
-               if (!dirname)
-                       goto err;
-               /* check if directory exists */
-               ret = osl_stat(dirname, &statbuf);
-               free(dirname);
-               if (ret < 0)
-                       goto err;
-               ret = -E_OSL_NOTDIR;
-               if (!S_ISDIR(statbuf.st_mode))
-                       goto err;
-       }
        ret = map_table(t, MAP_TBL_FL_VERIFY_INDEX);
        if (ret < 0)
                goto err;