From 534e8f432ab81f538ea2434cfb04fe978ff99895 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Mon, 17 Sep 2001 21:29:51 +0000 Subject: [PATCH] * vfs.c: Manually expand macros for mc_stat(), mc_lstat() and mc_fstat() because they don't expand correctly on Solaris 8 with large file support. --- vfs/ChangeLog | 6 ++++++ vfs/vfs.c | 39 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/vfs/ChangeLog b/vfs/ChangeLog index a7d0ed2e1..ab08bc473 100644 --- a/vfs/ChangeLog +++ b/vfs/ChangeLog @@ -1,3 +1,9 @@ +2001-09-17 Pavel Roskin + + * vfs.c: Manually expand macros for mc_stat(), mc_lstat() and + mc_fstat() because they don't expand correctly on Solaris 8 with + large file support. + 2001-09-10 Pavel Roskin * Make-mc.in: Use USE_VFS conditional instead of relying on diff --git a/vfs/vfs.c b/vfs/vfs.c index 9cf930ea1..64471826f 100644 --- a/vfs/vfs.c +++ b/vfs/vfs.c @@ -587,9 +587,42 @@ mc_closedir (DIR *dirp) return result; } -MC_NAMEOP (stat, (char *path, struct stat *buf), (vfs, vfs_name (path), buf)) -MC_NAMEOP (lstat, (char *path, struct stat *buf), (vfs, vfs_name (path), buf)) -MC_HANDLEOP (fstat, (int handle, struct stat *buf), (vfs_info (handle), buf)) +int mc_stat (char *path, struct stat *buf) { + vfs *vfs; + int result; + + path = vfs_canon (path); vfs = vfs_type (path); + result = vfs->stat ? (*vfs->stat) (vfs, vfs_name (path), buf) : -1; + g_free (path); + if (result == -1) + errno = vfs->name ? ferrno (vfs) : E_NOTSUPP; + return result; +} + +int mc_lstat (char *path, struct stat *buf) { + vfs *vfs; + int result; + + path = vfs_canon (path); vfs = vfs_type (path); + result = vfs->lstat ? (*vfs->lstat) (vfs, vfs_name (path), buf) : -1; + g_free (path); + if (result == -1) + errno = vfs->name ? ferrno (vfs) : E_NOTSUPP; + return result; +} + +int mc_fstat (int handle, struct stat *buf) { + vfs *vfs; + int result; + + if (handle == -1) + return -1; + vfs = vfs_op (handle); + result = vfs->fstat ? (*vfs->fstat) (vfs_info (handle), buf) : -1; + if (result == -1) + errno = vfs->name ? ferrno (vfs) : E_NOTSUPP; + return result; +} /* * You must g_strdup whatever this function returns, static buffers are in use