X-Git-Url: https://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fdirfd.c;h=8272e132d44dc27a9eee06b94d0519a505f17c0b;hb=84d1749c4b5ad026522be96537320556ec6f7a57;hp=18f5154a06ac8daf070907f1902bbfe9a80e5508;hpb=57fdfd3f8ec62b105c53bcdf6f127c35c7fe7391;p=gnulib.git diff --git a/lib/dirfd.c b/lib/dirfd.c index 18f5154a0..8272e132d 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-2013 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) +dirfd (DIR *dir_p) { - return DIR_TO_FD (dir_p); + int fd = DIR_TO_FD (dir_p); + if (fd == -1) + errno = ENOTSUP; + return fd; }