002-dont-use-isfdtype.patch 607 B

123456789101112131415161718192021
  1. Partially roll back upstream commit 4711119089e1ad08dad206f4fded68f1972fdeed
  2. since released versions of uClibc don't support isfdtype().
  3. Signed-off-by: Gustavo Zaarias <gustavo@zacarias.com.ar>
  4. Index: acpid-2.0.23/sock.c
  5. ===================================================================
  6. --- acpid-2.0.23.orig/sock.c
  7. +++ acpid-2.0.23/sock.c
  8. @@ -53,7 +53,10 @@ int non_root_clients;
  9. int
  10. is_socket(int fd)
  11. {
  12. - return (isfdtype(fd, S_IFSOCK) == 1);
  13. + int v;
  14. + socklen_t l = sizeof(int);
  15. +
  16. + return (getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&v, &l) == 0);
  17. }
  18. /* accept a new client connection */