* updated ktuberling (21.12.1 -> 21.12.2), untested
[t2-trunk.git] / package / lua / lua-posix / t2-realpath.patch
blobc6a97746f3c15dfd7c37d1755599cb45d3ec9085
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
3 #
4 # T2 SDE: package/.../lua-posix/t2-realpath.patch
5 # Copyright (C) 2008 - 2014 The T2 SDE Project
6 #
7 # More information can be found in the files COPYING and README.
8 #
9 # This patch file is dual-licensed. It is available under the license the
10 # patched project is licensed under, as long as it is an OpenSource license
11 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
12 # of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
14 # version.
15 # --- T2-COPYRIGHT-NOTE-END ---
17 --- posix.orig/lposix.c 2008-02-09 22:05:17.000000000 +0100
18 +++ posix/lposix.c 2008-02-09 22:11:53.000000000 +0100
19 @@ -305,6 +305,15 @@
20 return 1;
23 +static int Prealpath(lua_State *L) /** realpath(path) */
25 + char buf[PATH_MAX], *rpath;
26 + const char *path = luaL_checkstring(L, 1);
27 + rpath = realpath(path, buf);
28 + if (!rpath) return pusherror(L, path);
29 + lua_pushstring(L, buf);
30 + return 1;
33 static int Paccess(lua_State *L) /** access(path,[mode]) */
35 @@ -805,6 +814,7 @@
36 {"pathconf", Ppathconf},
37 {"putenv", Pputenv},
38 {"readlink", Preadlink},
39 + {"realpath", Prealpath},
40 {"rmdir", Prmdir},
41 {"setgid", Psetgid},
42 {"setuid", Psetuid},