}
int nfsmount(const char *spec, const char *node, int *flags,
- char **extra_opts, char **mount_opts, int running_bg)
+ char **mount_opts, int running_bg)
{
static char *prev_bg_host;
char hostdir[1024];
char new_opts[1024];
struct timeval total_timeout;
enum clnt_stat clnt_stat;
- static struct nfs_mount_data data;
+ struct nfs_mount_data data;
char *opt, *opteq;
int val;
struct hostent *hp;
/* add IP address to mtab options for use when unmounting */
s = inet_ntoa(server_addr.sin_addr);
- old_opts = *extra_opts;
+ old_opts = *mount_opts;
if (!old_opts)
old_opts = "";
if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) {
}
sprintf(new_opts, "%s%saddr=%s",
old_opts, *old_opts ? "," : "", s);
- *extra_opts = bb_xstrdup(new_opts);
+ *mount_opts = bb_xstrdup(new_opts);
/* Set default options.
* rsize/wsize (and bsize, for ver >= 3) are left 0 in order to
#endif
data.version = nfs_mount_version;
- *mount_opts = (char *) &data;
if (*flags & MS_REMOUNT)
- return 0;
+ goto copy_data_and_return;
/*
* If the previous mount operation on the same host was
auth_destroy(mclient->cl_auth);
clnt_destroy(mclient);
close(msock);
+copy_data_and_return:
+ *mount_opts = xrealloc(*mount_opts, sizeof(data));
+ memcpy(*mount_opts, &data, sizeof(data));
return 0;
/* abort */