[PHP-DEV] Re: Bug #262 Updated: dbminsert() failure / db.c flaws From: Ralf Pradella (pradella <email protected>)
Date: 04/30/98

> ID: 262

Jim (?),

[boolean returns]
> 2. This was a bug in the docs (for dbminsert(), at least).

To be honest (and picky), I was happy to see it the way it was documented.
This has long been a religeous (sp?) subject amongst C people, but
constructs like

do {
/* ... */
} while (!dbminsert(/*...*/));

are indeed more suggestive.

[dbm overwrites upon dbmopen(..., "w")]
> 3. We will need more information to reproduce this. I'm not sure
> what it is you're saying is unportable. Open another bug
> with more info if this is still a problem.

You e.g. #define DBM_WRITE_MODE "w+b"
and then seem to use DBM_WRITE_MODE as a regular variable which it isn't.
The result of e.g.

#define STR "blabla"
puts(strcmp(STR, STR) ? "Not really so equal..." : "Lucky you!");

is not predictable. Such coding is bad and will ever be so. Sorry if I
appear arrogant but you shouldn't do this.

However, upon a closer look this is not the essential point here.
Constructs where the above gets critical do not seem to appear in db.c.
It's in the modes: DBM_WRITE_MODE is "w+b", not "r+b".

regards,
rp