smbmount prob on 2.0.6pre3

Urban Widmark urban at svenskatest.se
Thu Nov 4 10:59:30 GMT 1999


On Thu, 4 Nov 1999, Bill Eldridge wrote:

> > Please test them out and feed back bugs/comments to
> > the lists.
> >         Jeremy Allison,
> >         Samba Team.
> 
> I keep getting errors like this:
> 
> khiva# /usr/sbin/smbmount //cna/rxcna /home/httpd/html/cna/rxcna -o
> guest,ro smbmnt failed
> mount.smb: ioctl failed, res=-1
> Could not umount /data/httpd/html/cna/rxcna: Invalid argument

Me too. You may want to try the included patch, apply from source/client/

It fixes 2 errors. If there is a BINDIR "/smbmnt it should execv
BINDIR "/smbmnt and not smbmnt (why it should choose the path as its
second option and not first is a different question).

The second thing is that waitpid may return errors (I don't handle them
here but I probably should) and that the status from waitpid is not a
returnvalue from that process.

This patch isn't entirely correct, but it makes it work (for me anyway :)

/Urban

--- smbmount.c.orig	Mon Nov  1 05:37:45 1999
+++ smbmount.c	Thu Nov  4 11:46:26 1999
@@ -381,7 +381,7 @@
 	pstring svc2;
 	struct cli_state *c;
 	char *args[20];
-	int i, retval;
+	int i, status;
 
 	if (realpath(mpoint, mount_point) == NULL) {
 		fprintf(stderr, "Could not resolve mount point %s\n", mpoint);
@@ -440,15 +440,21 @@
 
 	if (fork() == 0) {
 		if (file_exist(BINDIR "/smbmnt", NULL)) {
-			exit(execv("smbmnt", args));
+			execv(BINDIR "/smbmnt", args);
+			perror("execv");
 		} else {
-			exit(execvp("smbmnt", args));
+			execvp("smbmnt", args);
+			perror("execvp");
 		}
+		exit(1);
+	}
+	if (waitpid(-1, &status, 0) == -1) {
+	    perror("waitpid failed");
+	    /* FIXME: do some proper error handling */
+	    exit(1);
 	}
-	retval = -1;
-	waitpid(-1, &retval, 0);
-	if (retval) {
-		fprintf(stderr,"smbmnt failed\n");
+	if (WIFEXITED(status) && WEXITSTATUS(status) != 0) {
+		fprintf(stderr,"smbmnt failed: %d\n", WEXITSTATUS(status));
 	}
 
 	/* Ok...  This is the rubicon for that mount point...  At any point





More information about the samba mailing list