005-fix-struct-ucred-define 1.2 KB

123456789101112131415161718192021222324252627282930
  1. Index: sysrepo-0.7.0-7aa2f18d234267403147df92c0005c871f0aa840/src/common/sr_utils.c
  2. ===================================================================
  3. --- sysrepo-0.7.0-7aa2f18d234267403147df92c0005c871f0aa840.orig/src/common/sr_utils.c
  4. +++ sysrepo-0.7.0-7aa2f18d234267403147df92c0005c871f0aa840/src/common/sr_utils.c
  5. @@ -460,14 +460,24 @@ sr_fd_set_nonblock(int fd)
  6. #if defined(SO_PEERCRED)
  7. +#if defined(__GLIBC__)
  8. #if !defined(SCM_CREDENTIALS)
  9. -/* struct ucred is ifdefined behind __USE_GNU, but __USE_GNU is not defined */
  10. struct ucred {
  11. pid_t pid; /* process ID of the sending process */
  12. uid_t uid; /* user ID of the sending process */
  13. gid_t gid; /* group ID of the sending process */
  14. };
  15. #endif /* !defined(SCM_CREDENTIALS) */
  16. +#else
  17. +#if !defined(__USE_GNU)
  18. +struct ucred {
  19. + pid_t pid; /* process ID of the sending process */
  20. + uid_t uid; /* user ID of the sending process */
  21. + gid_t gid; /* group ID of the sending process */
  22. +};
  23. +/* struct ucred is ifdefined behind __USE_GNU, but __USE_GNU is not defined */
  24. +#endif /* !defined(__USE_GNU) */
  25. +#endif /* defined(__GLIBC__) */
  26. int
  27. sr_get_peer_eid(int fd, uid_t *uid, gid_t *gid)