diff --git a/crypto/compat/issetugid_hpux.c b/crypto/compat/issetugid_hpux.c index 73def9b..ca0e42c 100644 --- a/crypto/compat/issetugid_hpux.c +++ b/crypto/compat/issetugid_hpux.c @@ -4,23 +4,14 @@ /* * HP-UX does not have issetugid(). - * This experimental implementation uses pstat_getproc() and get*id(). - * First, try pstat_getproc() and check PS_CHANGEDPRIV bit of pst_flag. - * In case unsuccessful calling pstat_getproc(), using get*id(). - * + * Use pstat_getproc() and check PS_CHANGEDPRIV bit of pst_flag. If this call + * cannot be used, assume we must be running in a privileged environment. */ int issetugid(void) { struct pst_status buf; - if(pstat_getproc(&buf, sizeof(buf), 0, getpid()) != 1) { - perror("pstat_getproc()"); - } else { - if(buf.pst_flag & PS_CHANGEDPRIV) - return 1; - } - if(getuid() != geteuid()) - return 1; - if(getgid() != getegid()) - return 1; - return 0; + if (pstat_getproc(&buf, sizeof(buf), 0, getpid()) == 1 && + !(buf.pst_flag & PS_CHANGEDPRIV)) + return 0; + return 1; }