Guest User

patch for autofs-5.1.8

a guest
Jan 13th, 2024
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.16 KB | Source Code | 0 0
  1. oneechanhax-cubegame:/tmp/autofs# cat 0005-musl-mountoptions-fix.patch
  2. diff --git a/lib/mounts.c b/lib/mounts.c
  3. index 4c86688..2056498 100644
  4. --- a/lib/mounts.c
  5. +++ b/lib/mounts.c
  6. @@ -2379,11 +2379,18 @@ void set_tsd_user_vars(unsigned int logopt, uid_t uid, gid_t gid)
  7.  
  8.     /* Try to get passwd info */
  9.  
  10. +   /* sysconf may return -1 with unchanged errno to indicate unlimited
  11. +    * size, same for the call for _SC_GETGR_R_SIZE_MAX  below
  12. +    */
  13. +   errno = 0;
  14.     tmplen = sysconf(_SC_GETPW_R_SIZE_MAX);
  15. -   if (tmplen < 0) {
  16. +   if (tmplen < 0 && errno != 0) {
  17.         error(logopt, "failed to get buffer size for getpwuid_r");
  18.         goto free_tsv;
  19.     }
  20. +   if (tmplen < 0)
  21. +       tmplen = 1024;  /* assume something reasonable */
  22. +
  23.  
  24.     pw_tmp = malloc(tmplen + 1);
  25.     if (!pw_tmp) {
  26. @@ -2416,11 +2423,14 @@ void set_tsd_user_vars(unsigned int logopt, uid_t uid, gid_t gid)
  27.  
  28.     /* Try to get group info */
  29.  
  30. +   errno = 0;
  31.     grplen = sysconf(_SC_GETGR_R_SIZE_MAX);
  32. -   if (grplen < 0) {
  33. +   if (grplen < 0 && errno != 0) {
  34.         error(logopt, "failed to get buffer size for getgrgid_r");
  35.         goto free_tsv_home;
  36.     }
  37. +   if (grplen < 0)
  38. +       grplen = 1024;
  39.  
  40.     gr_tmp = NULL;
  41.     status = ERANGE;
Advertisement
Add Comment
Please, Sign In to add comment