summaryrefslogtreecommitdiff
path: root/ftpfs
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2002-04-20 03:22:47 +0000
committerMarcus Brinkmann <marcus@gnu.org>2002-04-20 03:22:47 +0000
commitc2d4102f8291fb8af9e29eceb378e4ebda87dda0 (patch)
tree62162dc85c27ffea6dd328a6b66e9678183a880b /ftpfs
parent4326834ca6c1fae1ab7f72f262ec2f4214928dd3 (diff)
ftpfs/
2002-04-13 Moritz Schulte <moritz@chaosdorf.de> * ftpfs.c: Include <sys/stat.h> (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 <moritz@chaosdorf.de> * unix.c: Include <libgen.h>. (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.
Diffstat (limited to 'ftpfs')
-rw-r--r--ftpfs/ChangeLog9
-rw-r--r--ftpfs/dir.c14
-rw-r--r--ftpfs/ftpfs.c26
3 files changed, 46 insertions, 3 deletions
diff --git a/ftpfs/ChangeLog b/ftpfs/ChangeLog
index 185ec775..e99034d8 100644
--- a/ftpfs/ChangeLog
+++ b/ftpfs/ChangeLog
@@ -1,3 +1,12 @@
+2002-04-13 Moritz Schulte <moritz@chaosdorf.de>
+
+ * ftpfs.c: Include <sys/stat.h>
+ (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.
+
2002-03-11 Roland McGrath <roland@frob.com>
* ftpfs.c (parse_startup_opt): If given one argument with no :,
diff --git a/ftpfs/dir.c b/ftpfs/dir.c
index 9e550ce8..6ae5facc 100644
--- a/ftpfs/dir.c
+++ b/ftpfs/dir.c
@@ -483,8 +483,9 @@ ftpfs_refresh_node (struct node *node)
if (!err && entry->noent)
err = ENOENT;
}
- else
+ else if (*(entry->name))
{
+ /* The root node is treated seperately below. */
struct ftp_conn *conn;
err = ftpfs_get_ftp_conn (dir->fs, &conn);
@@ -518,6 +519,17 @@ ftpfs_refresh_node (struct node *node)
entry->name_timestamp = timestamp;
}
}
+ else
+ {
+ /* Refresh the root node with the old stat
+ information. */
+ struct refresh_entry_state res;
+ res.entry = entry;
+ res.timestamp = timestamp;
+ err = update_old_entry (entry->name,
+ &netfs_root_node->nn_stat,
+ NULL, &res);
+ }
}
if ((entry->stat.st_mtime < node->nn_stat.st_mtime
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 <error.h>
#include <argz.h>
#include <netdb.h>
+#include <sys/stat.h>
#include <version.h>
@@ -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 ();