X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Futimens.c;h=bdb5a25ae61856a490232eaedbd1cbfa41091a94;hb=9f46144c41dd826d3bba1456f3f73497c570e87d;hp=b3a9a4a5fef99795253ba0d62c289b389db4bfc1;hpb=f32ad11f3c49f708a37d6d6f0327bc8444df2dcd;p=gnulib.git diff --git a/lib/utimens.c b/lib/utimens.c index b3a9a4a5f..bdb5a25ae 100644 --- a/lib/utimens.c +++ b/lib/utimens.c @@ -1,6 +1,6 @@ /* Set file access and modification times. - Copyright (C) 2003-2009 Free Software Foundation, Inc. + Copyright (C) 2003-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the @@ -264,19 +264,20 @@ fdutimens (char const *file, int fd, struct timespec const timespec[2]) } # endif /* HAVE_UTIMENSAT */ # if HAVE_FUTIMENS - { - result = futimens (fd, ts); + if (0 <= fd) + { + result = futimens (fd, ts); # ifdef __linux__ - /* Work around the same bug as above. */ - if (0 < result) - errno = ENOSYS; + /* Work around the same bug as above. */ + if (0 < result) + errno = ENOSYS; # endif /* __linux__ */ - if (result == 0 || errno != ENOSYS) - { - utimensat_works_really = 1; - return result; - } - } + if (result == 0 || errno != ENOSYS) + { + utimensat_works_really = 1; + return result; + } + } # endif /* HAVE_FUTIMENS */ } utimensat_works_really = -1;