Comment 2 for bug 18757

Revision history for this message
Colin Watson (cjwatson) wrote :

In this case it's what you get if you try to create a nonexistent directory
(with trailing slash) using open(), as the following short C program demonstrates:

#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>

int main(int argc, char **argv)
{
    int fd = open("nonexistent/", O_WRONLY | O_CREAT);
    if (fd < 0) {
        perror("open");
        return 1;
    }
    close(fd);
    return 0;
}

scp probably ought to be a little bit more careful; calling verifydir() when the
target ends in '/' would do it, I think. Still, it's minor.