X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fchdir-safer.c;h=03f372050f9decc43e326e406d7f9aa3af0b5821;hb=31d3154399f8c679ba23afb0f6bef03b73d4c741;hp=0df0b9da1b891205c5e7240ee6220978e97123e1;hpb=b596257ab957c7bafaa5acb9be7735eca1f5f56b;p=gnulib.git diff --git a/lib/chdir-safer.c b/lib/chdir-safer.c index 0df0b9da1..03f372050 100644 --- a/lib/chdir-safer.c +++ b/lib/chdir-safer.c @@ -50,8 +50,10 @@ chdir_no_follow (char const *dir) /* If open follows symlinks, lstat DIR and fstat FD to ensure that they are the same file; if they are different files, set errno to ELOOP (the same value that open uses for symlinks with - O_NOFOLLOW) so the caller can report a failure. */ - if (! O_NOFOLLOW) + O_NOFOLLOW) so the caller can report a failure. + Skip this check if ELOOP == 0, which should be the case + on any system that lacks symlink support. */ + if (ELOOP && ! HAVE_WORKING_O_NOFOLLOW) { struct stat sb1; result = lstat (dir, &sb1);