diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-09-06 01:03:10 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-09-06 01:03:10 +0200 |
commit | 41bcb43daf288851a7c817a740fdeb656e378dd4 (patch) | |
tree | c10d7e0ae0a82c5d5e9ab98c40dc63a1077683bd /libc/inet/rpc/rexec.c | |
parent | df5766bd4b7b020c54f683ebd24ab233defb74a9 (diff) |
rexec.c: style fixes, no code chages (verified with objdump)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libc/inet/rpc/rexec.c')
-rw-r--r-- | libc/inet/rpc/rexec.c | 67 |
1 files changed, 23 insertions, 44 deletions
diff --git a/libc/inet/rpc/rexec.c b/libc/inet/rpc/rexec.c index 11c4b9f83..a9d0dd66c 100644 --- a/libc/inet/rpc/rexec.c +++ b/libc/inet/rpc/rexec.c @@ -42,34 +42,12 @@ #include <string.h> #include <unistd.h> -/* Experimentally off - libc_hidden_proto(memset) */ -/* Experimentally off - libc_hidden_proto(strlen) */ -/* Experimentally off - libc_hidden_proto(strncpy) */ -/* libc_hidden_proto(read) */ -/* libc_hidden_proto(write) */ -/* libc_hidden_proto(close) */ -/* libc_hidden_proto(socket) */ -/* libc_hidden_proto(perror) */ -/* libc_hidden_proto(sprintf) */ -/* libc_hidden_proto(snprintf) */ -/* libc_hidden_proto(getsockname) */ -/* libc_hidden_proto(getnameinfo) */ -/* libc_hidden_proto(getaddrinfo) */ -/* libc_hidden_proto(freeaddrinfo) */ -/* libc_hidden_proto(sleep) */ -/* libc_hidden_proto(atoi) */ -/* libc_hidden_proto(connect) */ -/* libc_hidden_proto(accept) */ -/* libc_hidden_proto(listen) */ -/* libc_hidden_proto(ruserpass) */ - #define SA_LEN(_x) __libc_sa_len((_x)->sa_family) -extern int __libc_sa_len (sa_family_t __af) __THROW attribute_hidden; +extern int __libc_sa_len(sa_family_t __af) __THROW attribute_hidden; /* int rexecoptions; - google does not know it */ static char ahostbuf[NI_MAXHOST]; -/* libc_hidden_proto(rexec_af) */ int rexec_af(char **ahost, int rport, const char *name, const char *pass, const char *cmd, int *fd2p, sa_family_t af) { @@ -95,19 +73,19 @@ rexec_af(char **ahost, int rport, const char *name, const char *pass, const char hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_CANONNAME; gai = getaddrinfo(*ahost, servbuff, &hints, &res0); - if (gai){ + if (gai) { /* XXX: set errno? */ return -1; } - if (res0->ai_canonname){ + if (res0->ai_canonname) { strncpy(ahostbuf, res0->ai_canonname, sizeof(ahostbuf)); ahostbuf[sizeof(ahostbuf)-1] = '\0'; *ahost = ahostbuf; } - else{ + else { *ahost = NULL; - __set_errno (ENOENT); + __set_errno(ENOENT); return -1; } ruserpass(res0->ai_canonname, &name, &pass); @@ -115,7 +93,7 @@ retry: s = socket(res0->ai_family, res0->ai_socktype, 0); if (s < 0) { perror("rexec: socket"); - return (-1); + return -1; } if (connect(s, res0->ai_addr, res0->ai_addrlen) < 0) { if (errno == ECONNREFUSED && timo <= 16) { @@ -125,7 +103,7 @@ retry: goto retry; } perror(res0->ai_canonname); - return (-1); + return -1; } if (fd2p == 0) { (void) write(s, "", 1); @@ -138,10 +116,10 @@ retry: s2 = socket(res0->ai_family, res0->ai_socktype, 0); if (s2 < 0) { (void) close(s); - return (-1); + return -1; } listen(s2, 1); - sa2len = sizeof (sa2); + sa2len = sizeof(sa2); if (getsockname(s2, (struct sockaddr *)&sa2, &sa2len) < 0) { perror("getsockname"); (void) close(s2); @@ -158,15 +136,16 @@ retry: port = atoi(servbuff); (void) sprintf(num, "%u", port); (void) write(s, num, strlen(num)+1); - { socklen_t len = sizeof (from); - s3 = TEMP_FAILURE_RETRY (accept(s2, (struct sockaddr *)&from, - &len)); - close(s2); - if (s3 < 0) { - perror("accept"); - port = 0; - goto bad; - } + { + socklen_t len = sizeof(from); + s3 = TEMP_FAILURE_RETRY(accept(s2, + (struct sockaddr *)&from, &len)); + close(s2); + if (s3 < 0) { + perror("accept"); + port = 0; + goto bad; + } } *fd2p = s3; } @@ -178,9 +157,9 @@ retry: /* We don't need the memory allocated for the name and the password in ruserpass anymore. */ if (name != orig_name) - free ((char *) name); + free((char *) name); if (pass != orig_pass) - free ((char *) pass); + free((char *) pass); if (read(s, &c, 1) != 1) { perror(*ahost); @@ -195,13 +174,13 @@ retry: goto bad; } freeaddrinfo(res0); - return (s); + return s; bad: if (port) (void) close(*fd2p); (void) close(s); freeaddrinfo(res0); - return (-1); + return -1; } libc_hidden_def(rexec_af) |