Magellan Linux

Annotation of /trunk/mkinitrd-magellan/busybox/libbb/isdirectory.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 984 - (hide annotations) (download)
Sun May 30 11:32:42 2010 UTC (14 years ago) by niro
File MIME type: text/plain
File size: 790 byte(s)
-updated to busybox-1.16.1 and enabled blkid/uuid support in default config
1 niro 532 /* vi: set sw=4 ts=4: */
2     /*
3     * Utility routines.
4     *
5     * Based in part on code from sash, Copyright (c) 1999 by David I. Bell
6     * Permission has been granted to redistribute this code under the GPL.
7     *
8     * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
9     */
10    
11     #include <sys/stat.h>
12     #include "libbb.h"
13    
14     /*
15 niro 816 * Return TRUE if fileName is a directory.
16 niro 532 * Nonexistent files return FALSE.
17     */
18 niro 984 int FAST_FUNC is_directory(const char *fileName, int followLinks, struct stat *statBuf)
19 niro 532 {
20     int status;
21     struct stat astatBuf;
22    
23     if (statBuf == NULL) {
24 niro 816 /* use auto stack buffer */
25     statBuf = &astatBuf;
26 niro 532 }
27    
28     if (followLinks)
29     status = stat(fileName, statBuf);
30     else
31     status = lstat(fileName, statBuf);
32    
33 niro 816 status = (status == 0 && S_ISDIR(statBuf->st_mode));
34 niro 532
35     return status;
36     }