Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Jan 2009 22:19:21 +0100
From:      Christoph Mallon <christoph.mallon@gmx.de>
To:        obrien@freebsd.org
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r186504 - head/sbin/mount
Message-ID:  <496BB3D9.7020603@gmx.de>
In-Reply-To: <20090112175424.GA89144@dragon.NUXI.org>
References:  <200812262254.mBQMsrbR052676@svn.freebsd.org>	<4960FA9A.1090509@gmx.de> <20090111041543.GB17602@dragon.NUXI.org>	<4969A626.6070908@gmx.de> <20090112082510.GA69194@dragon.NUXI.org>	<496B10F9.20201@gmx.de> <20090112175424.GA89144@dragon.NUXI.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------040605090804050701070907
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 8bit

David O'Brien schrieb:
> On Mon, Jan 12, 2009 at 10:44:25AM +0100, Christoph Mallon wrote:
>> David O'Brien schrieb:
>>> On Sun, Jan 11, 2009 at 08:56:22AM +0100, Christoph Mallon wrote:
>>>> David O'Brien schrieb:
>>>>> On Sun, Jan 04, 2009 at 07:06:18PM +0100, Christoph Mallon wrote:
>>>>>> I'm pretty sure $SUPERNATURAL_BEING_OF_YOUR_CHOICE killed a kitten for 
>>>>>> the ugly hack you added to mount. The moment you overflow a buffer, you 
>>>>>> are in no man's land and there's no escape. I appended a patch, which 
>>>>>> solves this issue once and for all: The argv array gets dynamically 
>>>>>> expanded, when its limit is reached.
>>>>>> Please - for all kittens out there - commit this patch.
>>>>> Hi Christoph,
>>>>> Unfortunately your patch doesn't work.
>>>>> For a 'ufs' file system listed in /etc/fstab
>>>>>     $ umount /foo
>>>>>     $ mount /foo
>>>>> Does not work.
>>>> Why haven't you told me earlier?
>>> Wow, wish I did have the gift to know something before I know something.
>>> Especially tomorrow's lotto #'s. ;-)
>> I sent you my patch almost a week before you commited your changes. I 
>> think, there was enough time to tell me, that my patch had a flaw. 
> 
> Christoph when I work for you for $$, then you can be demanding on when
> I read email and test the attached patches.  Since this is in my free
> time...
> 
>> I've attached a corrected version of my patch, which has a mnt_argc = 0; 
>> added in order to reset the argument vector on reentry of mountfs() 
>> (instead of appending to the arguments of the last round).
> 
> If you want me to read your patches - stop making larger changes than
> necessary - that primarily undo the changes I've already done.  Instead
> send patches that fix bugs you find in smaller ways (unless that's not
> possible).
> 
> thanks,

David, when I work for you for €€, then you can be demanding on how I 
write patches to suit your taste. Since this is in my free time...

Instead, to show that I'm not resentful and in case you didn't fully 
read my last email, here's a last piece of free advice: You broke HEAD 
in r187093. So take the attached patch and run with it.

You're welcome

--------------040605090804050701070907
Content-Type: text/plain;
 name="mount.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="mount.diff"

Index: mount.c
===================================================================
--- mount.c	(Revision 187093)
+++ mount.c	(Arbeitskopie)
@@ -70,6 +70,7 @@
 
 struct cpa {
 	char	**a;
+	int	sz;
 	int	c;
 };
 
@@ -503,11 +504,9 @@
 static void
 append_arg(struct cpa *sa, char *arg)
 {
-	static int a_sz;
-
-	if (sa->c + 1 == a_sz) {
-		a_sz = a_sz == 0 ? 8 : a_sz * 2;
-		sa->a = realloc(sa->a, sizeof(sa->a) * a_sz);
+	if (sa->c + 1 == sa->sz) {
+		sa->sz = sa->sz == 0 ? 8 : sa->sz * 2;
+		sa->a = realloc(sa->a, sizeof(sa->a) * sa->sz);
 		if (sa->a == NULL)
 			errx(1, "realloc failed");
 	}
@@ -518,11 +517,10 @@
 mountfs(const char *vfstype, const char *spec, const char *name, int flags,
 	const char *options, const char *mntopts)
 {
-	struct cpa mnt_argv;
+	static struct cpa mnt_argv;
 	struct statfs sf;
 	int i, ret;
 	char *optbuf, execname[PATH_MAX], mntpath[PATH_MAX];
-	static int mnt_argv_inited;
 
 	/* resolve the mountpoint with realpath(3) */
 	(void)checkpath(name, mntpath);
@@ -557,10 +555,6 @@
 	/* Construct the name of the appropriate mount command */
 	(void)snprintf(execname, sizeof(execname), "mount_%s", vfstype);
 
-	if (!mnt_argv_inited) {
-		mnt_argv_inited++;
-		mnt_argv.a = NULL;
-	}
 	mnt_argv.c = -1;
 	append_arg(&mnt_argv, execname);
 	mangle(optbuf, &mnt_argv);

--------------040605090804050701070907--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?496BB3D9.7020603>