Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Feb 2018 21:48:02 +0100
From:      Oliver Pinter <oliver.pinter@hardenedbsd.org>
To:        Conrad Meyer <cem@freebsd.org>
Cc:        "src-committers@freebsd.org" <src-committers@freebsd.org>,  "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>,  "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r329649 - head/stand/liblua
Message-ID:  <CAPQ4fftdDb8z8O5ZBPGveV5PPp6m5NNpUODDUstRQPZPkpp4UA@mail.gmail.com>
In-Reply-To: <201802201821.w1KILUUg079715@repo.freebsd.org>
References:  <201802201821.w1KILUUg079715@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday, February 20, 2018, Conrad Meyer <cem@freebsd.org> wrote:

> Author: cem
> Date: Tue Feb 20 18:21:30 2018
> New Revision: 329649
> URL: https://svnweb.freebsd.org/changeset/base/329649
>
> Log:
>   Lua lfs.attributes: Provide a more consistent error return
>
>   In the remaining error case, return a 3-tuple consistent with the other
>   error return case.
>
>   Document how to invoke lfs.attributes() and detect/decode error return in
>   example comments.
>
>   Reviewed by:  kevans
>   Sponsored by: Dell EMC Isilon
>   Differential Revision:        https://reviews.freebsd.org/D14451
>
> Modified:
>   head/stand/liblua/lfs.c
>
> Modified: head/stand/liblua/lfs.c
> ============================================================
> ==================
> --- head/stand/liblua/lfs.c     Tue Feb 20 18:12:07 2018        (r329648)
> +++ head/stand/liblua/lfs.c     Tue Feb 20 18:21:30 2018        (r329649)
> @@ -80,13 +80,20 @@ __FBSDID("$FreeBSD$");
>   * (etc.)
>   *
>   * The other available API is lfs.attributes(), which functions somewhat
> like
> - * stat(2) and returns a table of values:
> + * stat(2) and returns a table of values.  Example code:
>   *
> - *     for k, v in pairs(lfs.attributes("/boot")) do
> + *     attrs, errormsg, errorcode = lfs.attributes("/boot")
> + *     if attrs == nil then
> + *         print(errormsg)
> + *         return errorcode
> + *     end
> + *
> + *     for k, v in pairs(attrs) do
>   *         print(k .. ":\t" .. v)
>   *     end
> + *     return 0


Hi!

Missing  ; at the end of lines here.


>   *
> - * Prints:
> + * Prints (on success):
>   *     gid:    0
>   *     change: 140737488342640
>   *     mode:   directory
> @@ -277,7 +284,9 @@ lua_attributes(lua_State *L)
>         path = luaL_checkstring(L, 1);
>         if (path == NULL) {
>                 lua_pushnil(L);
> -               return 1;
> +               lua_pushfstring(L, "cannot convert first argument to
> string");
> +               lua_pushinteger(L, EINVAL);
> +               return 3;
>         }
>
>         rc = stat(path, &sb);
> _______________________________________________
> svn-src-head@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-head
> To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAPQ4fftdDb8z8O5ZBPGveV5PPp6m5NNpUODDUstRQPZPkpp4UA>