aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lfs.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/lfs.c b/src/lfs.c
index e1dfb74..01f4076 100644
--- a/src/lfs.c
+++ b/src/lfs.c
@@ -9,7 +9,7 @@
9** lfs.lock (fh, mode) 9** lfs.lock (fh, mode)
10** lfs.unlock (fh) 10** lfs.unlock (fh)
11** 11**
12** $Id: lfs.c,v 1.7 2004/11/01 08:57:56 tomas Exp $ 12** $Id: lfs.c,v 1.8 2004/11/01 15:27:13 tomas Exp $
13*/ 13*/
14 14
15#include <errno.h> 15#include <errno.h>
@@ -64,10 +64,15 @@ typedef struct dir_data {
64*/ 64*/
65static int change_dir (lua_State *L) { 65static int change_dir (lua_State *L) {
66 const char *path = luaL_checkstring(L, 1); 66 const char *path = luaL_checkstring(L, 1);
67 if (chdir(path)) 67 if (chdir(path)) {
68 luaL_error(L,"Unable to change working directory to '%s'\n%s\n", 68 lua_pushnil (L);
69 lua_pushfstring (L,"Unable to change working directory to '%s'\n%s\n",
69 path, chdir_error); 70 path, chdir_error);
70 return 0; 71 return 2;
72 } else {
73 lua_pushboolean (L, 1);
74 return 1;
75 }
71} 76}
72 77
73/* 78/*
@@ -234,6 +239,8 @@ static int make_dir (lua_State *L) {
234 S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH ); 239 S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH );
235#endif 240#endif
236 lua_pushboolean (L, !fail); 241 lua_pushboolean (L, !fail);
242 if (fail)
243 lua_pushfstring (L, "%s", strerror(errno));
237 umask (oldmask); 244 umask (oldmask);
238 return 1; 245 return 1;
239} 246}