Question about d_ino used in scp.c - openssh

This is a discussion on Question about d_ino used in scp.c - openssh ; Hi, There's exactly one usage of the dirent.d_ino member in the whole project, which is in the readdir loop in scp.c, like this: while (readdir) { if (d_ino == 0) continue; [...] } This loop is basically taken from rcp.c ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Question about d_ino used in scp.c

  1. Question about d_ino used in scp.c

    Hi,

    There's exactly one usage of the dirent.d_ino member in the whole
    project, which is in the readdir loop in scp.c, like this:

    while (readdir) {
    if (d_ino == 0)
    continue;
    [...]
    }

    This loop is basically taken from rcp.c as far as I can see. However,
    I have two problems here.

    - First, I have no idea why and when readdir should return an entry with
    a 0 inode number. Is that historically?

    - Second, POSIX does not demand the existence of the d_ino member in
    dirent. Only systems which claim to be X/Open compatible are required
    to have the d_ino member in dirent. See

    http://www.opengroup.org/onlinepubs/.../dirent.h.html

    and

    http://www.opengroup.org/onlinepubs/...l#tag_02_01_04

    Since it's fairly tricky and time consuming to generate the correct
    inode number when running the Windows equivalent of readdir, the d_ino
    entry was faked in Cygwin by using a name hash for a long time now.
    The problem is that this doesn't match the inode number returned by
    the Windows equivalent of the stat function, which can result in some
    applications creating dubious error messages.

    So, after some wailing and chattering we're now trying to get rid of
    the d_ino field entirely, since we're not trying to be X/Open
    compatible. We would already be happy to be POSIX compliant :-}

    The question now is this. Is the above test for a 0 inode number
    still required or is that something long gone? And, if it's still
    required, would it be ok to disable the test for system which are not
    X/Open compatible, either by using some define (_XOPEN_UNIX ?), or by
    adding a configure test for d_ino?


    Thanks in advance,
    Corinna

    --
    Corinna Vinschen
    Cygwin Project Co-Leader
    Red Hat

    _______________________________________________
    openssh-unix-dev mailing list
    openssh-unix-dev@mindrot.org
    http://www.mindrot.org/mailman/listi...enssh-unix-dev

  2. Re: Question about d_ino used in scp.c

    This may not necessarily be on the same topic... but I am having a
    helluva time trying to get OpenSSH to compile (3.8.1p1, 4.1p1) under
    Cygwin...

    Info: resolving ___progname by linking to __imp____progname
    (auto-import)
    Info: resolving _optarg by linking to __imp__optarg (auto-import)
    Info: resolving _optind by linking to __imp__optind (auto-import)
    gcc -g -O2 -Wall -Wpointer-arith -Wno-uninitialized -I. -I.
    -DSSHDIR=\"/usr/local/etc\" -D_PATH_SSH_PROGRAM=\"/usr/loca
    l/bin/ssh\"
    -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/local/libexec/ssh-askpass\"
    -D_PATH_SFTP_SERVER=\"/usr/local/libexec/sftp
    -server\" -D_PATH_SSH_KEY_SIGN=\"/usr/local/libexec/ssh-keysign\"
    -D_PATH_SSH_PIDDIR=\"/var/run\" -D_PATH_PRIVSEP_CHROOT
    _DIR=\"/var/empty\"
    -DSSH_RAND_HELPER=\"/usr/local/libexec/ssh-rand-helper\"
    -DHAVE_CONFIG_H -c scp.c
    scp.c: In function `rsource':
    scp.c:644: error: structure has no member named `d_ino'
    make: *** [scp.o] Error 1

    I've simply commented out lines 643-644 ... not sure if this is the
    correct action (don't really have time to dig too much) but it
    worked...


+ Reply to Thread