diff options
Diffstat (limited to 'source3/client')
-rw-r--r-- | source3/client/client.c | 14 | ||||
-rw-r--r-- | source3/client/smbmount.c | 25 | ||||
-rw-r--r-- | source3/client/smbspool.c | 4 |
3 files changed, 27 insertions, 16 deletions
diff --git a/source3/client/client.c b/source3/client/client.c index 3047a9a61b..b4b48da285 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -28,6 +28,8 @@ #define REGISTER 0 #endif +const char prog_name[] = "smbclient"; + struct cli_state *cli; extern BOOL in_client; static int port = 0; @@ -2404,7 +2406,6 @@ static int do_message_op(void) pstring query_host; BOOL message = False; extern char tar_type; - static pstring servicesf = CONFIGFILE; pstring term_code; pstring new_name_resolve_order; char *p; @@ -2436,12 +2437,12 @@ static int do_message_op(void) dbf = x_stderr; else if(strncmp(argv[opt], "-s", 2) == 0) { if(argv[opt][2] != '\0') - pstrcpy(servicesf, &argv[opt][2]); + pstrcpy(dyn_CONFIGFILE, &argv[opt][2]); else if(argv[opt+1] != NULL) { /* * At least one more arg left. */ - pstrcpy(servicesf, argv[opt+1]); + pstrcpy(dyn_CONFIGFILE, argv[opt+1]); } else { usage(pname); exit(1); @@ -2454,8 +2455,9 @@ static int do_message_op(void) in_client = True; /* Make sure that we tell lp_load we are */ old_debug = DEBUGLEVEL; - if (!lp_load(servicesf,True,False,False)) { - fprintf(stderr, "Can't load %s - run testparm to debug it\n", servicesf); + if (!lp_load(dyn_CONFIGFILE,True,False,False)) { + fprintf(stderr, "%s: Can't load %s - run testparm to debug it\n", + prog_name, dyn_CONFIGFILE); } DEBUGLEVEL = old_debug; @@ -2536,7 +2538,7 @@ static int do_message_op(void) getopt(argc, argv,"s:O:R:M:i:Nn:d:Pp:l:hI:EU:L:t:m:W:T:D:c:b:A:k")) != EOF) { switch (opt) { case 's': - pstrcpy(servicesf, optarg); + pstrcpy(dyn_CONFIGFILE, optarg); break; case 'O': pstrcpy(user_socket_options,optarg); diff --git a/source3/client/smbmount.c b/source3/client/smbmount.c index d41d26ec37..d3265ee606 100644 --- a/source3/client/smbmount.c +++ b/source3/client/smbmount.c @@ -403,9 +403,9 @@ static void send_fs_socket(char *service, char *mount_point, struct cli_state *c } -/**************************************************************************** -mount smbfs -****************************************************************************/ +/** + * Mount a smbfs + **/ static void init_mount(void) { char mount_point[MAXPATHLEN+1]; @@ -475,13 +475,22 @@ static void init_mount(void) } if (sys_fork() == 0) { - if (file_exist(BINDIR "/smbmnt", NULL)) { - execv(BINDIR "/smbmnt", args); - fprintf(stderr,"execv of %s failed. Error was %s.", BINDIR "/smbmnt", strerror(errno)); + char *smbmnt_path; + + smbmnt_path = asprintf("%s/smbmnt", dyn_BINDIR); + + if (file_exist(smbmnt_path, NULL)) { + execv(smbmnt_path, args); + fprintf(stderr, + "smbfs/init_mount: execv of %s failed. Error was %s.", + smbmnt_path, strerror(errno)); } else { execvp("smbmnt", args); - fprintf(stderr,"execvp of smbmnt failed. Error was %s.", strerror(errno) ); + fprintf(stderr, + "smbfs/init_mount: execv of %s failed. Error was %s.", + "smbmnt", strerror(errno)); } + free(smbmnt_path); exit(1); } @@ -801,7 +810,7 @@ static void parse_mount_smb(int argc, char **argv) { extern char *optarg; extern int optind; - static pstring servicesf = CONFIGFILE; + static pstring servicesf = dyn_CONFIGFILE; char *p; DEBUGLEVEL = 1; diff --git a/source3/client/smbspool.c b/source3/client/smbspool.c index 69454825f8..03d4a34060 100644 --- a/source3/client/smbspool.c +++ b/source3/client/smbspool.c @@ -191,9 +191,9 @@ static int smb_print(struct cli_state *, char *, FILE *); in_client = True; /* Make sure that we tell lp_load we are */ - if (!lp_load(CONFIGFILE, True, False, False)) + if (!lp_load(dyn_CONFIGFILE, True, False, False)) { - fprintf(stderr, "ERROR: Can't load %s - run testparm to debug it\n", CONFIGFILE); + fprintf(stderr, "ERROR: Can't load %s - run testparm to debug it\n", dyn_CONFIGFILE); return (1); } |