sanity check for dlb_fopen

Fail if dlb_fopen is called with a non-read mode.
This commit is contained in:
keni
2012-01-09 22:42:48 +00:00
parent 1563a3e0ec
commit e442242417

View File

@@ -468,6 +468,9 @@ dlb_fopen(name, mode)
if (!dlb_initialized) return (dlb *) 0;
/* only support reading; ignore possible binary flag */
if (!mode || mode[0] != 'r') return (dlb *)0;
dp = (dlb *) alloc(sizeof(dlb));
if (do_dlb_fopen(dp, name, mode))
dp->fp = (FILE *) 0;