X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftinfo%2Fwrite_entry.c;h=b1daf1649e2086389b45c263538c68e4e3224d42;hp=3f6eebfcb33d9ae1f35fac5b5dfde2c3b591d776;hb=5e36f11feab6f790e0cc6f2c882a67b7b65e3b6b;hpb=03f728e5bb3630a54fffc4a2ff2f8dbfcce9088e diff --git a/ncurses/tinfo/write_entry.c b/ncurses/tinfo/write_entry.c index 3f6eebfc..b1daf164 100644 --- a/ncurses/tinfo/write_entry.c +++ b/ncurses/tinfo/write_entry.c @@ -47,7 +47,7 @@ #define TRACE_OUT(p) /*nothing */ #endif -MODULE_ID("$Id: write_entry.c,v 1.81 2011/10/22 15:33:37 tom Exp $") +MODULE_ID("$Id: write_entry.c,v 1.82 2011/10/30 14:33:13 tom Exp $") static int total_written; @@ -127,18 +127,17 @@ make_db_path(char *dst, const char *src, size_t limit) } #if USE_HASHED_DB if (rc == 0) { - if (_nc_is_dir_path(dst)) { - rc = -1; - } else { - static const char suffix[] = DBM_SUFFIX; - size_t have = strlen(dst); - size_t need = strlen(suffix); - if (have > need && strcmp(dst + (int) (have - need), suffix)) { - if (have + need <= limit) - strcat(dst, suffix); - else - rc = -1; + static const char suffix[] = DBM_SUFFIX; + size_t have = strlen(dst); + size_t need = strlen(suffix); + if (have > need && strcmp(dst + (int) (have - need), suffix)) { + if (have + need <= limit) { + strcat(dst, suffix); + } else { + rc = -1; } + } else if (_nc_is_dir_path(dst)) { + rc = -1; } } #endif @@ -158,10 +157,11 @@ make_db_root(const char *path) #if USE_HASHED_DB DB *capdbp; - if ((capdbp = _nc_db_open(fullpath, TRUE)) == NULL) + if ((capdbp = _nc_db_open(fullpath, TRUE)) == NULL) { rc = -1; - else if (_nc_db_close(capdbp) < 0) + } else if (_nc_db_close(capdbp) < 0) { rc = -1; + } #else struct stat statbuf;