| 1 | /* $Id: b_fsSymlinkStat.c 1804 2005-02-01 05:43:45Z bird $ */
|
|---|
| 2 | /** @file
|
|---|
| 3 | *
|
|---|
| 4 | * LIBC SYS Backend - lstat.
|
|---|
| 5 | *
|
|---|
| 6 | * Copyright (c) 2004 knut st. osmundsen <[email protected]>
|
|---|
| 7 | *
|
|---|
| 8 | *
|
|---|
| 9 | * This file is part of InnoTek LIBC.
|
|---|
| 10 | *
|
|---|
| 11 | * InnoTek LIBC is free software; you can redistribute it and/or modify
|
|---|
| 12 | * it under the terms of the GNU Lesser General Public License as published
|
|---|
| 13 | * by the Free Software Foundation; either version 2 of the License, or
|
|---|
| 14 | * (at your option) any later version.
|
|---|
| 15 | *
|
|---|
| 16 | * InnoTek LIBC is distributed in the hope that it will be useful,
|
|---|
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 19 | * GNU Lesser General Public License for more details.
|
|---|
| 20 | *
|
|---|
| 21 | * You should have received a copy of the GNU Lesser General Public License
|
|---|
| 22 | * along with InnoTek LIBC; if not, write to the Free Software
|
|---|
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 24 | *
|
|---|
| 25 | */
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 | /*******************************************************************************
|
|---|
| 29 | * Header Files *
|
|---|
| 30 | *******************************************************************************/
|
|---|
| 31 | #include "b_fs.h"
|
|---|
| 32 | #include <sys/stat.h>
|
|---|
| 33 | #include <InnoTekLIBC/backend.h>
|
|---|
| 34 | #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS
|
|---|
| 35 | #include <InnoTekLIBC/logstrict.h>
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 | /**
|
|---|
| 39 | * Stats a symbolic link.
|
|---|
| 40 | *
|
|---|
| 41 | * @returns 0 on success.
|
|---|
| 42 | * @returns Negative error code (errno.h) on failure.
|
|---|
| 43 | * @param pszPath Path to the file to stat. If this is a symbolic link
|
|---|
| 44 | * the link it self will be stat'ed.
|
|---|
| 45 | * @param pStat Where to store the file stats.
|
|---|
| 46 | */
|
|---|
| 47 | int __libc_Back_fsSymlinkStat(const char *pszPath, struct stat *pStat)
|
|---|
| 48 | {
|
|---|
| 49 | LIBCLOG_ENTER("pszPath=%p:{%s} pStat=%p\n", (void *)pszPath, pszPath, (void *)pStat);
|
|---|
| 50 |
|
|---|
| 51 | /*
|
|---|
| 52 | * Resolve the path.
|
|---|
| 53 | */
|
|---|
| 54 | char szNativePath[PATH_MAX];
|
|---|
| 55 | int rc = __libc_back_fsResolve(pszPath, BACKFS_FLAGS_RESOLVE_PARENT | BACKFS_FLAGS_RESOLVE_DIR_MAYBE, szNativePath, NULL);
|
|---|
| 56 | if (!rc)
|
|---|
| 57 | rc = __libc_back_fsNativeFileStat(szNativePath, pStat);
|
|---|
| 58 |
|
|---|
| 59 | LIBCLOG_RETURN_INT(rc);
|
|---|
| 60 | }
|
|---|
| 61 |
|
|---|