24 |
#include <error.h> |
#include <error.h> |
25 |
#include <argz.h> |
#include <argz.h> |
26 |
#include <netdb.h> |
#include <netdb.h> |
27 |
|
#include <sys/stat.h> |
28 |
|
|
29 |
#include <version.h> |
#include <version.h> |
30 |
|
|
366 |
main (int argc, char **argv) |
main (int argc, char **argv) |
367 |
{ |
{ |
368 |
error_t err; |
error_t err; |
369 |
mach_port_t bootstrap; |
mach_port_t bootstrap, underlying_node; |
370 |
|
struct stat underlying_stat; |
371 |
const struct argp_child argp_children[] = |
const struct argp_child argp_children[] = |
372 |
{ {&common_argp}, {&netfs_std_startup_argp}, {0} }; |
{ {&common_argp}, {&netfs_std_startup_argp}, {0} }; |
373 |
struct argp argp = |
struct argp argp = |
397 |
|
|
398 |
netfs_root_node = ftpfs->root; |
netfs_root_node = ftpfs->root; |
399 |
|
|
400 |
netfs_startup (bootstrap, 0); |
underlying_node = netfs_startup (bootstrap, 0); |
401 |
|
err = io_stat (underlying_node, &underlying_stat); |
402 |
|
if (err) |
403 |
|
error (1, err, "cannot stat underling node"); |
404 |
|
|
405 |
|
/* Initialize stat information of the root node. */ |
406 |
|
netfs_root_node->nn_stat = underlying_stat; |
407 |
|
netfs_root_node->nn_stat.st_mode = |
408 |
|
S_IFDIR | (underlying_stat.st_mode & ~S_IFMT & ~S_ITRANS); |
409 |
|
|
410 |
|
/* If the underlying node isn't a directory, propagate read permission to |
411 |
|
execute permission since we need that for lookups. */ |
412 |
|
if (! S_ISDIR (underlying_stat.st_mode)) |
413 |
|
{ |
414 |
|
if (underlying_stat.st_mode & S_IRUSR) |
415 |
|
netfs_root_node->nn_stat.st_mode |= S_IXUSR; |
416 |
|
if (underlying_stat.st_mode & S_IRGRP) |
417 |
|
netfs_root_node->nn_stat.st_mode |= S_IXGRP; |
418 |
|
if (underlying_stat.st_mode & S_IROTH) |
419 |
|
netfs_root_node->nn_stat.st_mode |= S_IXOTH; |
420 |
|
} |
421 |
|
|
422 |
for (;;) |
for (;;) |
423 |
netfs_server_loop (); |
netfs_server_loop (); |