X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Ffsusage.c;h=e90abf94d836b6546311be637983d3aa9a8ccfcb;hb=4c03f9a7f4ca25c6f65936b206ae10c8d371b2a2;hp=d9d5234bd98214d4cc7b4d96c341131a260af7b2;hpb=037030812016e27513ac48e5abc7a1b85590a596;p=gnulib.git diff --git a/lib/fsusage.c b/lib/fsusage.c index d9d5234bd..e90abf94d 100644 --- a/lib/fsusage.c +++ b/lib/fsusage.c @@ -1,5 +1,5 @@ /* fsusage.c -- return space usage of mounted filesystems - Copyright (C) 1991, 1992 Free Software Foundation, Inc. + Copyright (C) 1991, 1992, 1996 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 @@ -90,8 +90,9 @@ adjust_blocks (blocks, fromsize, tosize) the filesystem on which PATH resides. DISK is the device on which PATH is mounted, for space-getting methods that need to know it. - Return 0 if successful, -1 if not. */ - + Return 0 if successful, -1 if not. When returning -1, ensure that + ERRNO is either a system error value, or zero if DISK is NULL + on a system that requires a non-NULL value. */ int get_fs_usage (path, disk, fsp) const char *path; @@ -133,6 +134,12 @@ get_fs_usage (path, disk, fsp) struct filsys fsd; int fd; + if (! disk) + { + errno = 0; + return -1; + } + fd = open (disk, O_RDONLY); if (fd < 0) return -1;