summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-03-04 13:54:00 +0000
committerLudovic Courtès <ludo@gnu.org>2012-03-04 13:54:00 +0000
commit4d76e911ebffe02142a6246888123979a6f5fea4 (patch)
tree4565448ec9810d6e63f4434321296c4379b5e004
parentfab6b7bf9c091ef49c3773e0952d1f12809f1ac7 (diff)
Call `task_get_bootstrap_port' after `argp_parse'.
This allows users to run `/hurd/smbfs --help'.
-rw-r--r--smbfs.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/smbfs.c b/smbfs.c
index 723be886b..a2fb21383 100644
--- a/smbfs.c
+++ b/smbfs.c
@@ -1,6 +1,8 @@
/*
Copyright (C) 2004, 2007, 2009 Free Software Foundation, Inc.
Copyright (C) 2004, 2007, 2009 Giuseppe Scrivano.
+ Copyright (C) 2012 Ludovic Courtès <ludo@gnu.org>
+
Written by Giuseppe Scrivano <gscrivano@gnu.org>
This program is free software; you can redistribute it and/or
@@ -73,23 +75,24 @@ main (int argc, char *argv[])
{
mach_port_t bootstrap;
int err;
- task_get_bootstrap_port (mach_task_self (), &bootstrap);
- if (bootstrap == MACH_PORT_NULL)
- error (EXIT_FAILURE, errno, "You need to run this as a translator!");
credentials.server = 0;
credentials.share = 0;
credentials.workgroup = 0;
credentials.username = 0;
credentials.password = 0;
-
+
argp_parse(&smb_argp, argc, argv, 0, 0, &credentials);
-
+
if(!credentials.server || !credentials.share || !credentials.workgroup
|| !credentials.username || !credentials.password)
error (EXIT_FAILURE, EINVAL, "You must specify server - share - workgroup - username "
" - password !!!\n");
+ task_get_bootstrap_port (mach_task_self (), &bootstrap);
+ if (bootstrap == MACH_PORT_NULL)
+ error (EXIT_FAILURE, errno, "You need to run this as a translator!");
+
err = init_smb ();
if (err < 0)