From c2d4102f8291fb8af9e29eceb378e4ebda87dda0 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Sat, 20 Apr 2002 03:22:47 +0000 Subject: ftpfs/ 2002-04-13 Moritz Schulte * ftpfs.c: Include (main): Stat the underlying node and initialize the root node's stat information. * dir.c (ftpfs_refresh_node): If refreshing the root node, simply use the old stat information. libftpconn/ 2002-04-13 Moritz Schulte * unix.c: Include . (struct get_stats_state): New member: searched_name. (ftp_conn_unix_start_get_stats): Return EINVAL if trying to list the root node without listing it's content; set searched_name to the dirname. (ftp_conn_unix_cont_get_stats): If searching for the list info of one entry, skip all other entries. --- ftpfs/ftpfs.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'ftpfs/ftpfs.c') diff --git a/ftpfs/ftpfs.c b/ftpfs/ftpfs.c index 4efb5ffb..86fea34c 100644 --- a/ftpfs/ftpfs.c +++ b/ftpfs/ftpfs.c @@ -24,6 +24,7 @@ #include #include #include +#include #include @@ -365,7 +366,8 @@ int main (int argc, char **argv) { error_t err; - mach_port_t bootstrap; + mach_port_t bootstrap, underlying_node; + struct stat underlying_stat; const struct argp_child argp_children[] = { {&common_argp}, {&netfs_std_startup_argp}, {0} }; struct argp argp = @@ -395,7 +397,27 @@ main (int argc, char **argv) netfs_root_node = ftpfs->root; - netfs_startup (bootstrap, 0); + underlying_node = netfs_startup (bootstrap, 0); + err = io_stat (underlying_node, &underlying_stat); + if (err) + error (1, err, "cannot stat underling node"); + + /* Initialize stat information of the root node. */ + netfs_root_node->nn_stat = underlying_stat; + netfs_root_node->nn_stat.st_mode = + S_IFDIR | (underlying_stat.st_mode & ~S_IFMT & ~S_ITRANS); + + /* If the underlying node isn't a directory, propagate read permission to + execute permission since we need that for lookups. */ + if (! S_ISDIR (underlying_stat.st_mode)) + { + if (underlying_stat.st_mode & S_IRUSR) + netfs_root_node->nn_stat.st_mode |= S_IXUSR; + if (underlying_stat.st_mode & S_IRGRP) + netfs_root_node->nn_stat.st_mode |= S_IXGRP; + if (underlying_stat.st_mode & S_IROTH) + netfs_root_node->nn_stat.st_mode |= S_IXOTH; + } for (;;) netfs_server_loop (); -- cgit v1.2.3