libs/nixio: don't close stdin, stdout or stderr during garbage collection
authorJo-Philipp Wich <jow@openwrt.org>
Sun, 19 Jul 2009 02:39:10 +0000 (02:39 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Sun, 19 Jul 2009 02:39:10 +0000 (02:39 +0000)
libs/nixio/src/file.c

index 70c717e4e17e62ca8bcce6899ecf0d012d724a09..9f99fb8277c334d39b679c949ea78591b093b113 100644 (file)
@@ -329,7 +329,7 @@ static int nixio_file_close(lua_State *L) {
 static int nixio_file__gc(lua_State *L) {
        int *fdp = luaL_checkudata(L, 1, NIXIO_FILE_META);
        int res;
-       if (*fdp != -1) {
+       if (*fdp > 2) {
                do {
                        res = close(*fdp);
                } while (res == -1 && errno == EINTR);