From: Rod Widdowson Date: Thu, 28 Oct 2010 17:34:41 +0000 (+0100) Subject: Windows: fix built in touch X-Git-Tag: openafs-devel-1_5_78~9 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=deed8d63348508a6bcbda49e64b73cfd41ce2199;p=packages%2Fo%2Fopenafs.git Windows: fix built in touch Recent versions of windows add a whole bunch of attributes above A_ARCH. (FILE_ATTRIBUTE_NOT_CONTENT_INDEXED was what bit be but encryption of compression would do it). This makes ~_A_ARCH not a good choice for testing nonwritability of a file - so files with these new attributes just get silently ignored. Using an explicit mask is much better. So do that. Reviewed-on: http://gerrit.openafs.org/3182 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear (cherry picked from commit 68aace4054430105ceaf52ce8e316f3ae01e7dc8) Change-Id: Ia481b1b36dbecbeca5a9e69dbcd78b7a754f9cc9 Reviewed-on: http://gerrit.openafs.org/3239 Tested-by: BuildBot --- diff --git a/src/config/touch.c b/src/config/touch.c index e6e20cd54..6644105e7 100644 --- a/src/config/touch.c +++ b/src/config/touch.c @@ -25,6 +25,14 @@ usage() exit(1); } +/* + * Construct the mask explicitly. Later versions of windows start filling + * in higher bits and that doesn't affect the operation + */ + +#define ATTRIBUTE_MASK (_A_RDONLY | _A_HIDDEN | _A_SYSTEM | _A_SUBDIR) + + int main(int argc, char *argv[]) { @@ -40,7 +48,7 @@ main(int argc, char *argv[]) return 0; do { - if ((finfo.attrib & ~_A_ARCH) != _A_NORMAL) + if ((finfo.attrib & ATTRIBUTE_MASK) != _A_NORMAL) continue; fh = _open(finfo.name, _S_IWRITE | _O_BINARY | _S_IREAD | _O_RDWR); pos = _lseek(fh, 0L, SEEK_END);