Bugzilla – Attachment 1609 Details for
Bug 1566
superfluous descriptor duplications in sftp-server
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
suggested patch
sftp-server-fds.patch (text/plain), 1.89 KB, created by
Jan Pechanec
on 2009-03-05 01:31:32 AEDT
(
hide
)
Description:
suggested patch
Filename:
MIME Type:
Creator:
Jan Pechanec
Created:
2009-03-05 01:31:32 AEDT
Size:
1.89 KB
patch
obsolete
>--- sftp-server.c.orig Wed Mar 4 14:55:14 2009 >+++ sftp-server.c Wed Mar 4 14:57:22 2009 >@@ -1330,7 +1330,7 @@ > sftp_server_main(int argc, char **argv, struct passwd *user_pw) > { > fd_set *rset, *wset; >- int in, out, max, ch, skipargs = 0, log_stderr = 0; >+ int max, ch, skipargs = 0, log_stderr = 0; > ssize_t len, olen, set_size; > SyslogFacility log_facility = SYSLOG_FACILITY_AUTH; > char *cp, buf[4*4096]; >@@ -1387,19 +1387,14 @@ > logit("session opened for local user %s from [%s]", > pw->pw_name, client_addr); > >- in = dup(STDIN_FILENO); >- out = dup(STDOUT_FILENO); >- > #ifdef HAVE_CYGWIN >- setmode(in, O_BINARY); >- setmode(out, O_BINARY); >+ setmode(STDIN_FILENO, O_BINARY); >+ setmode(STDOUT_FILENO, O_BINARY); > #endif > >- max = 0; >- if (in > max) >- max = in; >- if (out > max) >- max = out; >+ max = STDOUT_FILENO; >+ if (STDIN_FILENO > STDOUT_FILENO) >+ max = STDIN_FILENO; > > buffer_init(&iqueue); > buffer_init(&oqueue); >@@ -1419,11 +1414,11 @@ > */ > if (buffer_check_alloc(&iqueue, sizeof(buf)) && > buffer_check_alloc(&oqueue, SFTP_MAX_MSG_LENGTH)) >- FD_SET(in, rset); >+ FD_SET(STDIN_FILENO, rset); > > olen = buffer_len(&oqueue); > if (olen > 0) >- FD_SET(out, wset); >+ FD_SET(STDOUT_FILENO, wset); > > if (select(max+1, rset, wset, NULL, NULL) < 0) { > if (errno == EINTR) >@@ -1433,8 +1428,8 @@ > } > > /* copy stdin to iqueue */ >- if (FD_ISSET(in, rset)) { >- len = read(in, buf, sizeof buf); >+ if (FD_ISSET(STDIN_FILENO, rset)) { >+ len = read(STDIN_FILENO, buf, sizeof buf); > if (len == 0) { > debug("read eof"); > sftp_server_cleanup_exit(0); >@@ -1446,8 +1441,8 @@ > } > } > /* send oqueue to stdout */ >- if (FD_ISSET(out, wset)) { >- len = write(out, buffer_ptr(&oqueue), olen); >+ if (FD_ISSET(STDOUT_FILENO, wset)) { >+ len = write(STDOUT_FILENO, buffer_ptr(&oqueue), olen); > if (len < 0) { > error("write: %s", strerror(errno)); > sftp_server_cleanup_exit(1);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1566
: 1609