Ver Fonte

fix close(-1) segfaults on mips64

Waldemar Brodkorb há 11 anos atrás
pai
commit
580a519f91
1 ficheiros alterados com 20 adições e 0 exclusões
  1. 20 0
      package/busybox/patches/011-utmp-segfault-mips64-fix.patch

+ 20 - 0
package/busybox/patches/011-utmp-segfault-mips64-fix.patch

@@ -0,0 +1,20 @@
+diff -Nur busybox-1.20.2.orig/libbb/utmp.c busybox-1.20.2/libbb/utmp.c
+--- busybox-1.20.2.orig/libbb/utmp.c	2012-06-26 15:35:45.000000000 +0200
++++ busybox-1.20.2/libbb/utmp.c	2012-09-24 20:25:27.000000000 +0200
+@@ -10,8 +10,14 @@
+ 
+ static void touch(const char *filename)
+ {
+-	if (access(filename, R_OK | W_OK) == -1)
+-		close(open(filename, O_WRONLY | O_CREAT, 0664));
++        int c = 0;
++
++        if (access(filename, R_OK | W_OK) == -1) {
++                c=open(filename, O_WRONLY | O_CREAT, 0664);
++                if (c > 0) {
++                        close(c);
++                }
++        }
+ }
+ 
+ void FAST_FUNC write_new_utmp(pid_t pid, int new_type, const char *tty_name, const char *username, const char *hostname)