011-utmp-segfault-mips64-fix.patch 729 B

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