[Pkg-zfsonlinux-devel] Bug#839071: Bug#839071: Patch for bug #839071

Petter Reinholdtsen pere at hungry.com
Thu Sep 29 08:17:00 UTC 2016


Hi.

I got a quick question.  The patch seem to set MNTTAB to
"/proc/self/mounts", but include changes like this:

[Eric Desrochers]
> --- a/cmd/mount_zfs/mount_zfs.c
> +++ b/cmd/mount_zfs/mount_zfs.c
> @@ -292,11 +292,11 @@ mtab_is_writeable(void)
>  	struct stat st;
>  	int error, fd;
>  
> -	error = lstat(MNTTAB, &st);
> +	error = lstat("/etc/mtab", &st);
>  	if (error || S_ISLNK(st.st_mode))
>  		return (0);
>  
> -	fd = open(MNTTAB, O_RDWR | O_CREAT, 0644);
> +	fd = open("/etc/mtab", O_RDWR | O_CREAT, 0644);
>  	if (fd < 0)
>  		return (0);
>  
> @@ -318,21 +318,21 @@ mtab_update(char *dataset, char *mntpoint, char *type, char *mntopts)
>  	mnt.mnt_freq = 0;
>  	mnt.mnt_passno = 0;
>  
> -	fp = setmntent(MNTTAB, "a+");
> +	fp = setmntent("/etc/mtab", "a+");
>  	if (!fp) {
>  		(void) fprintf(stderr, gettext(
> -		    "filesystem '%s' was mounted, but %s "
> +		    "filesystem '%s' was mounted, but /etc/mtab "
>  		    "could not be opened due to error %d\n"),
> -		    dataset, MNTTAB, errno);
> +		    dataset, errno);
>  		return (MOUNT_FILEIO);
>  	}
>  
>  	error = addmntent(fp, &mnt);
>  	if (error) {
>  		(void) fprintf(stderr, gettext(
> -		    "filesystem '%s' was mounted, but %s "
> +		    "filesystem '%s' was mounted, but /etc/mtab "
>  		    "could not be updated due to error %d\n"),
> -		    dataset, MNTTAB, errno);
> +		    dataset, errno);
>  		return (MOUNT_FILEIO);
>  	}
>  

Why do you hardcode /etc/mtab here?  I fail to understand how your patch
is intended to work, and hope you can reduce my confusion.

-- 
Happy hacking
Petter Reinholdtsen



More information about the Pkg-zfsonlinux-devel mailing list