diff options
author | mascarenhas <mascarenhas> | 2008-01-25 17:09:56 +0000 |
---|---|---|
committer | mascarenhas <mascarenhas> | 2008-01-25 17:09:56 +0000 |
commit | 78f28b64686390592792e2d5abba26c6f815d534 (patch) | |
tree | 90c3be06659882267f1934058751155bf4996881 /src | |
parent | 25f8aa1936ecdb30abe6b7d87744dd2f6ea1c3d0 (diff) | |
download | luafilesystem-78f28b64686390592792e2d5abba26c6f815d534.tar.gz luafilesystem-78f28b64686390592792e2d5abba26c6f815d534.tar.bz2 luafilesystem-78f28b64686390592792e2d5abba26c6f815d534.zip |
lfs.attributes raises an error if attribute does not exist
Diffstat (limited to 'src')
-rw-r--r-- | src/lfs.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -15,7 +15,7 @@ | |||
15 | ** lfs.touch (filepath [, atime [, mtime]]) | 15 | ** lfs.touch (filepath [, atime [, mtime]]) |
16 | ** lfs.unlock (fh) | 16 | ** lfs.unlock (fh) |
17 | ** | 17 | ** |
18 | ** $Id: lfs.c,v 1.45 2008/01/16 22:33:24 mascarenhas Exp $ | 18 | ** $Id: lfs.c,v 1.46 2008/01/25 17:09:56 mascarenhas Exp $ |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <errno.h> | 21 | #include <errno.h> |
@@ -525,6 +525,9 @@ static void push_st_blksize (lua_State *L, struct stat *info) { | |||
525 | lua_pushnumber (L, (lua_Number)info->st_blksize); | 525 | lua_pushnumber (L, (lua_Number)info->st_blksize); |
526 | } | 526 | } |
527 | #endif | 527 | #endif |
528 | static void push_invalid (lua_State *L, struct stat *info) { | ||
529 | luaL_error(L, "invalid attribute name"); | ||
530 | } | ||
528 | 531 | ||
529 | typedef void (*_push_function) (lua_State *L, struct stat *info); | 532 | typedef void (*_push_function) (lua_State *L, struct stat *info); |
530 | 533 | ||
@@ -549,7 +552,7 @@ struct _stat_members members[] = { | |||
549 | { "blocks", push_st_blocks }, | 552 | { "blocks", push_st_blocks }, |
550 | { "blksize", push_st_blksize }, | 553 | { "blksize", push_st_blksize }, |
551 | #endif | 554 | #endif |
552 | { NULL, NULL } | 555 | { NULL, push_invalid } |
553 | }; | 556 | }; |
554 | 557 | ||
555 | /* | 558 | /* |