X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=lib%2Fdirfd.c;h=81993c502c1f89c71304d7390c9df8240a86d782;hb=refs%2Fheads%2F313237;hp=18f5154a06ac8daf070907f1902bbfe9a80e5508;hpb=138fc7e67e3d9845cd7d81aad0e9c7724784f9b9;p=tar diff --git a/lib/dirfd.c b/lib/dirfd.c index 18f5154..81993c5 100644 --- a/lib/dirfd.c +++ b/lib/dirfd.c @@ -1,6 +1,6 @@ /* dirfd.c -- return the file descriptor associated with an open DIR* - Copyright (C) 2001, 2006 Free Software Foundation, Inc. + Copyright (C) 2001, 2006, 2008-2009 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 @@ -19,10 +19,14 @@ #include -#include "dirfd.h" +#include +#include int dirfd (DIR const *dir_p) { - return DIR_TO_FD (dir_p); + int fd = DIR_TO_FD (dir_p); + if (fd == -1) + errno = ENOTSUP; + return fd; }