Skip to content

Commit

Permalink
fsdev: Fix parameter parsing for proxy helper
Browse files Browse the repository at this point in the history
This fixes a crash when using sockfd with proxy FsDriver

Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
  • Loading branch information
M. Mohan Kumar authored and kvaneesh committed Jan 30, 2012
1 parent 71f86cd commit 5fc6dba
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions fsdev/virtfs-proxy-helper.c
Expand Up @@ -1036,7 +1036,13 @@ int main(int argc, char **argv)
return -1; return -1;
} }


if (*sock_name && (own_u == -1 || own_g == -1)) { if (sock_name && sock != -1) {
fprintf(stderr, "both named socket and socket descriptor specified\n");
usage(argv[0]);
exit(EXIT_FAILURE);
}

if (sock_name && (own_u == -1 || own_g == -1)) {
fprintf(stderr, "owner uid:gid not specified, "); fprintf(stderr, "owner uid:gid not specified, ");
fprintf(stderr, fprintf(stderr,
"owner uid:gid specifies who can access the socket file\n"); "owner uid:gid specifies who can access the socket file\n");
Expand Down Expand Up @@ -1064,7 +1070,7 @@ int main(int argc, char **argv)
} }


do_log(LOG_INFO, "Started\n"); do_log(LOG_INFO, "Started\n");
if (*sock_name) { if (sock_name) {
sock = proxy_socket(sock_name, own_u, own_g); sock = proxy_socket(sock_name, own_u, own_g);
if (sock < 0) { if (sock < 0) {
goto error; goto error;
Expand Down

0 comments on commit 5fc6dba

Please sign in to comment.