[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [patch] fix nits in recent cwrapper patch
From: |
Noah Misch |
Subject: |
Re: [patch] fix nits in recent cwrapper patch |
Date: |
Fri, 8 Jun 2007 13:48:19 -0700 |
User-agent: |
Mutt/1.5.9i |
On Fri, Jun 08, 2007 at 01:11:17PM -0400, Charles Wilson wrote:
> if ((stat (path, &st) >= 0) && (
> - /* MinGW & native WIN32 do not support
> S_IXOTH or S_IXGRP */
> -#if defined (S_IXOTH)
> - ((st.st_mode & S_IXOTH) == S_IXOTH) ||
> -#endif
> -#if defined (S_IXGRP)
> - ((st.st_mode & S_IXGRP) == S_IXGRP) ||
> -#endif
> + ((S_IXOTH != 0) && ((st.st_mode & S_IXOTH)
> == S_IXOTH)) ||
> + ((S_IXGRP != 0) && ((st.st_mode & S_IXGRP)
> == S_IXGRP)) ||
> ((st.st_mode & S_IXUSR) == S_IXUSR)))
You can write this more simply:
if (stat (path, &st) >= 0 && st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))
(Or even `access (path, X_OK) == 0', if MSYS has that.)
The rest looks good to me. Thank you.