Changeset 227 for trunk/src/slib.c


Ignore:
Timestamp:
Apr 20, 2009, 5:59:31 PM (16 years ago)
Author:
katerina
Message:

Fix warnings with -fstack-check

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/slib.c

    r214 r227  
    14731473#if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETPWNAM_R)
    14741474      struct passwd    pwd;
    1475       char             buffer[SH_PWBUF_SIZE];
     1475      char          *  buffer;
    14761476      struct passwd *  tempres;
    1477       sh_getpwnam_r(user, &pwd, buffer, sizeof(buffer), &tempres);
     1477      buffer = malloc(SH_PWBUF_SIZE);
     1478      SL_REQUIRE (buffer != NULL, _("buffer != NULL"));
     1479      sh_getpwnam_r(user, &pwd, buffer, SH_PWBUF_SIZE, &tempres);
    14781480#else
    14791481      struct passwd * tempres = sh_getpwnam(user);
     
    14841486      rgid_orig = tempres->pw_gid;
    14851487      ruid_orig = tempres->pw_uid;
     1488#if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETPWNAM_R)
     1489      free(buffer);
     1490#endif
    14861491    }
    14871492  else
     
    15161521#if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETPWNAM_R)
    15171522      struct passwd    pwd;
    1518       char             buffer[SH_PWBUF_SIZE];
     1523      char          *  buffer;
    15191524      struct passwd *  tempres;
    1520       sh_getpwnam_r(user, &pwd, buffer, sizeof(buffer), &tempres);
     1525      buffer = malloc(SH_PWBUF_SIZE);
     1526      SL_REQUIRE (buffer != NULL, _("buffer != NULL"));
     1527      sh_getpwnam_r(user, &pwd, buffer, SH_PWBUF_SIZE, &tempres);
    15211528#else
    15221529      struct passwd * tempres = sh_getpwnam(user);
     
    15271534      SL_REQUIRE (sl_drop_privileges() == SL_ENONE,
    15281535                  _("sl_drop_privileges() == SL_ENONE"));
     1536#if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETPWNAM_R)
     1537      free(buffer);
     1538#endif
    15291539    }
    15301540  SL_IRETURN(SL_ENONE, _("sl_policy_get_user"));
Note: See TracChangeset for help on using the changeset viewer.