Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] Use gdbm_errno with gdbm_open



Sebastian Gniazdowski wrote on Sat, Mar 25, 2017 at 07:55:54 +0100:
> +++ b/Src/Modules/db_gdbm.c
> @@ -154,12 +154,13 @@ bin_ztie(char *nam, char **args, Options ops, UNUSED(int func))
> +    gdbm_errno=0;

Nitpick: whitespace around assignment operator.

>      dbf = gdbm_open(resource_name, 0, read_write, 0666, 0);
>      if(dbf) {
>  	addmodulefd(gdbm_fdesc(dbf), FDT_MODULE);
>          append_tied_name(pmname);
>      } else {
> -	zwarnnam(nam, "error opening database file %s", resource_name);
> +	zwarnnam(nam, "error opening database file %s (%s)", resource_name, gdbm_strerror(gdbm_errno));

How about
    "error opening database file '%s'; gdbm error: %s"
?

That is: add quotes, avoid parentheses around pertinent information, and
sign gdbm's error message.  (I'd have used %q as in printf(1), but
I don't think zerrmsg() supports that yet.)

Cheers,

Daniel



Messages sorted by: Reverse Date, Date, Thread, Author