9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] malloc(0) fails in u9fs
@ 2002-11-29 14:28 Russ Cox
  2002-11-29 16:47 ` Mike Haertel
  0 siblings, 1 reply; 3+ messages in thread
From: Russ Cox @ 2002-11-29 14:28 UTC (permalink / raw)
  To: 9fans

Thanks.  That's the correct workaround.

Russ


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] malloc(0) fails in u9fs
  2002-11-29 14:28 [9fans] malloc(0) fails in u9fs Russ Cox
@ 2002-11-29 16:47 ` Mike Haertel
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Haertel @ 2002-11-29 16:47 UTC (permalink / raw)
  To: 9fans

>Thanks.  That's the correct workaround.

It's not a workaround, it's a fix.  ANSI C allows
malloc(0) to return 0.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [9fans] malloc(0) fails in u9fs
@ 2002-11-29  5:58 YAMANASHI Takeshi
  0 siblings, 0 replies; 3+ messages in thread
From: YAMANASHI Takeshi @ 2002-11-29  5:58 UTC (permalink / raw)
  To: 9fans

I run u9fs on Tru64 UNIX but it gives `malloc(0) fails'.
I added the following fragment in emalloc() in u9fs.c.
I agree it could be an extremely nasty work-around.

/sys/src/cmd/unix/u9fs/u9fs.c:/^emalloc
	void *p;

>	if (n == 0)
>		n = 1;
	p = malloc(n);
	if(p == 0)


(I used bundled CC, not GCC.)
--
YAMANASHI Takeshi



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-11-29 16:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-29 14:28 [9fans] malloc(0) fails in u9fs Russ Cox
2002-11-29 16:47 ` Mike Haertel
  -- strict thread matches above, loose matches on Subject: below --
2002-11-29  5:58 YAMANASHI Takeshi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).