summaryrefslogtreecommitdiffhomepage
path: root/libs/nixio/src/file.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2009-10-26 04:52:07 +0000
committerFelix Fietkau <nbd@openwrt.org>2009-10-26 04:52:07 +0000
commit64d9a00a9934cd06401f4b9ec2e14950a4423a87 (patch)
tree99f8a9f96407f1420e36a37f02a000346dc6ca81 /libs/nixio/src/file.c
parent2181825db596a12d23f56fa8fbfebd94f99b13c4 (diff)
nixio: store stats and other number information as integer, which works better when lua number support is downgraded from double to float
Diffstat (limited to 'libs/nixio/src/file.c')
-rw-r--r--libs/nixio/src/file.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libs/nixio/src/file.c b/libs/nixio/src/file.c
index 9f99fb8277..bb9e0844b2 100644
--- a/libs/nixio/src/file.c
+++ b/libs/nixio/src/file.c
@@ -226,7 +226,7 @@ static int nixio_file_read(lua_State *L) {
static int nixio_file_seek(lua_State *L) {
int fd = nixio__checkfd(L, 1);
- off_t len = (off_t)luaL_checknumber(L, 2);
+ off_t len = (off_t)luaL_checkinteger(L, 2);
int whence;
const char *whstr = luaL_optlstring(L, 3, "set", NULL);
if (!strcmp(whstr, "set")) {
@@ -242,7 +242,7 @@ static int nixio_file_seek(lua_State *L) {
if (len == -1) {
return nixio__perror(L);
} else {
- lua_pushnumber(L, len);
+ lua_pushinteger(L, len);
return 1;
}
}
@@ -253,7 +253,7 @@ static int nixio_file_tell(lua_State *L) {
if (pos < 0) {
return nixio__perror(L);
} else {
- lua_pushnumber(L, pos);
+ lua_pushinteger(L, pos);
return 1;
}
}
@@ -291,7 +291,7 @@ static int nixio_file_sync(lua_State *L) {
static int nixio_file_lock(lua_State *L) {
int fd = nixio__checkfd(L, 1);
const char *flag = luaL_checkstring(L, 2);
- off_t len = (off_t)luaL_optnumber(L, 3, 0);
+ off_t len = (off_t)luaL_optinteger(L, 3, 0);
int stat;
int cmd = 0;