Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F173818232
D14451.id39529.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D14451.id39529.diff
View Options
Index: stand/liblua/lfs.c
===================================================================
--- stand/liblua/lfs.c
+++ stand/liblua/lfs.c
@@ -80,13 +80,20 @@
* (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
*
- * Prints:
+ * Prints (on success):
* gid: 0
* change: 140737488342640
* mode: directory
@@ -277,7 +284,9 @@
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);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Sep 29, 4:22 PM (13 h, 44 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39884934
Default Alt Text
D14451.id39529.diff (1 KB)
Attached To
Mode
D14451: Lua lfs.attributes: Provide a more consistent error return
Attached
Detach File
Event Timeline
Log In to Comment