Date: Mon, 15 Apr 2002 23:24:19 +0100 From: David Malone <dwmalone@maths.tcd.ie> To: Thomas Quinot <thomas@cuivre.fr.eu.org> Cc: freebsd-bugs@FreeBSD.org Subject: Re: bin/37104 [PATCH] Message-ID: <20020415222419.GA46761@lanczos.maths.tcd.ie> In-Reply-To: <200204152110.g3FLA2M65236@freefall.freebsd.org> References: <200204152110.g3FLA2M65236@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Apr 15, 2002 at 02:10:02PM -0700, Thomas Quinot wrote:
> The following patch seems to fix the problem. Addresses on the stack are
> beyond 2**31, i.e. a negative long. Changing the offset parameter
> to an off_t and using fseeko allows the correct seek to be made.
>
> addresses on the stack are beyond 2**31, i.e. some negative long value.
I wonder would uintptr_t be better than unsigned long in the patch?
David.
> --- usr.bin/truss/dist/syscalls.c Mon Apr 15 22:44:49 2002
> +++ usr.bin/truss/syscalls.c Mon Apr 15 22:48:18 2002
> @@ -137,7 +137,7 @@
> err(1, "dup");
> if ((p = fdopen(fd, "r")) == NULL)
> err(1, "fdopen");
> - fseek(p, (long)offset, SEEK_SET);
> + fseeko(p, (unsigned long)offset, SEEK_SET);
> for (pos = (char *)buf; len--; pos++) {
> if ((c = fgetc(p)) == EOF)
> return -1;
> @@ -167,7 +167,7 @@
> buf = malloc( size = (max ? max : 64 ) );
> len = 0;
> buf[0] = 0;
> - fseek(p, (long)offset, SEEK_SET);
> + fseeko(p, (unsigned long)offset, SEEK_SET);
> while ((c = fgetc(p)) != EOF) {
> buf[len++] = c;
> if (c == 0 || len == max) {
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020415222419.GA46761>
