Software / code / prosody
Comparison
util-src/pposix.c @ 2443:b335ae55af77
util.pposix: Add mkdir(path)
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sun, 10 Jan 2010 23:12:22 +0000 |
| parent | 2441:d72078946a16 |
| child | 2455:0b3184f3c9e4 |
comparison
equal
deleted
inserted
replaced
| 2442:94c676b585c0 | 2443:b335ae55af77 |
|---|---|
| 369 lua_pushstring(L, old_mode_string); | 369 lua_pushstring(L, old_mode_string); |
| 370 | 370 |
| 371 return 1; | 371 return 1; |
| 372 } | 372 } |
| 373 | 373 |
| 374 int lc_mkdir(lua_State* L) | |
| 375 { | |
| 376 int ret = mkdir(luaL_checkstring(L, 1), S_IRUSR | S_IWUSR | S_IXUSR | |
| 377 | S_IRGRP | S_IWGRP | S_IXGRP | |
| 378 | S_IROTH | S_IXOTH); /* mode 775 */ | |
| 379 | |
| 380 lua_pushboolean(L, ret==0); | |
| 381 if(ret) | |
| 382 { | |
| 383 lua_pushstring(L, strerror(errno)); | |
| 384 return 2; | |
| 385 } | |
| 386 return 1; | |
| 387 } | |
| 388 | |
| 374 /* Like POSIX's setrlimit()/getrlimit() API functions. | 389 /* Like POSIX's setrlimit()/getrlimit() API functions. |
| 375 * | 390 * |
| 376 * Syntax: | 391 * Syntax: |
| 377 * pposix.setrlimit( resource, soft limit, hard limit) | 392 * pposix.setrlimit( resource, soft limit, hard limit) |
| 378 * | 393 * |
| 503 { "setuid", lc_setuid }, | 518 { "setuid", lc_setuid }, |
| 504 { "setgid", lc_setgid }, | 519 { "setgid", lc_setgid }, |
| 505 | 520 |
| 506 { "umask", lc_umask }, | 521 { "umask", lc_umask }, |
| 507 | 522 |
| 523 { "mkdir", lc_mkdir }, | |
| 524 | |
| 508 { "setrlimit", lc_setrlimit }, | 525 { "setrlimit", lc_setrlimit }, |
| 509 { "getrlimit", lc_getrlimit }, | 526 { "getrlimit", lc_getrlimit }, |
| 510 | 527 |
| 511 { NULL, NULL } | 528 { NULL, NULL } |
| 512 }; | 529 }; |