2.2-CVS failing on Solaris 8
Michael Collin Nielsen
michael at hum.auc.dk
Thu Jun 21 20:17:18 GMT 2001
Great :-) Thanks a lot Jeremy. Actually the Solaris man page on mmap
claims:
Upon successful completion, the mmap() function returns the
address at which the mapping was placed (pa); otherwise, it
returns a value of MAP_FAILED and sets errno to indicate the
error. The symbol MAP_FAILED is defined in the header
<sys/mman.h>. No successful return from mmap() will return
the value MAP_FAILED.
So the patch probably could be made more readable (for Andrew ;-)
A great job you are doing!
-Mcihael
On Thu, 21 Jun 2001, Jeremy Allison wrote:
> Michael Collin Nielsen wrote:
> >
> > Hi
> >
> > I ran gdb/xxgdb on smbd and placed a breakpoint just before the line in
> > question, the variables has the following values:
> >
> > 4: len = 4
> > 3: (char *) tdb->map_ptr = 0xffffffff <Address 0xffffffff out of bounds>
> > 2: off = 172
> > 1: buf = (void *) 0xffbef5bc
> >
> > is that close to what you need - map_ptr doesn't look good.
>
> Arrggghhh ! Andrew did it to me again ! :-) :-).
>
> I fixed this a month ago and it got regressed.
>
> mmap returns -1 when it fails, not NULL.....
>
> Here's the patch.
>
> Jeremy.
>
> Index: tdb/tdb.c
> ===================================================================
> RCS file: /data/cvs/samba/source/tdb/tdb.c,v
> retrieving revision 1.35.4.25
> diff -u -r1.35.4.25 tdb.c
> --- tdb/tdb.c 11 Jun 2001 20:56:49 -0000 1.35.4.25
> +++ tdb/tdb.c 21 Jun 2001 19:48:45 -0000
> @@ -87,7 +87,13 @@
> tdb->map_ptr = mmap(NULL, tdb->map_size,
> PROT_READ|(tdb->read_only? 0:PROT_WRITE),
> MAP_SHARED|MAP_FILE, tdb->fd, 0);
> - if (!tdb->map_ptr) {
> +
> + /*
> + * NB. When mmap fails it returns -1 *NOT* NULL !!!!
> + */
> +
> + if (tdb->map_ptr == (void *)-1) {
> + tdb->map_ptr = NULL;
> TDB_LOG((tdb, 2, "tdb_mmap failed for size %d (%s)\n",
> tdb->map_size, strerror(errno)));
> }
>
>
> --
> --------------------------------------------------------
> Buying an operating system without source is like buying
> a self-assembly Space Shuttle with no instructions.
> --------------------------------------------------------
>
--
Michael Collin Nielsen mailto:michael at hum.auc.dk
M.Sc.E.E. http://www.hum.auc.dk/~michael
Sysadm in Faculty of Humanities, Aalborg University
More information about the samba-technical
mailing list