Hi,

I noticed the following with the reproducable command:

openrsync -av rsync://127.0.0.1/ftp/ a

ktrace:

-> 99882 openrsync CALL  close(1249939456)
-> 99882 openrsync RET   close -1 errno 9 Bad file descriptor
   99882 openrsync CALL  kbind(0x7f7fffff7a50,24,0x281ae61c4bf1563c)
   99882 openrsync RET   kbind 0
   99882 openrsync CALL  socket(AF_INET,0x1<SOCK_STREAM>,0)
   99882 openrsync RET   socket 3

rsync_connect is called with sd uninitialized, but in inet_connect() it checks
against sd:

        if (*sd != -1)
                close(*sd);

Patch below:


diff --git usr.bin/rsync/main.c usr.bin/rsync/main.c
index 967e6528bc2..fa0e749e642 100644
--- usr.bin/rsync/main.c
+++ usr.bin/rsync/main.c
@@ -271,7 +271,7 @@ main(int argc, char *argv[])
 {
        struct opts      opts;
        pid_t            child;
-       int              fds[2], sd, rc, c, st, i;
+       int              fds[2], sd = -1, rc, c, st, i;
        struct sess       sess;
        struct fargs    *fargs;
        char            **args;

-- 
Kind regards,
Hiltjo

Reply via email to