-/* Copyright (C) 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
void
__open_catalog (__nl_catd catalog, int with_path)
{
- int fd;
+ int fd = -1;
struct stat st;
int swapping;
}
}
- if (fd < 0 || __fstat (fd, &st) < 0)
+ if (fd < 0 || __fstat (fd, &st) < 0 || !S_ISREG (st.st_mode))
{
+ __close (fd);
catalog->status = nonexisting;
return;
}
catalog->file_ptr = malloc (st.st_size);
if (catalog->file_ptr == NULL)
{
+ __close (fd);
catalog->status = nonexisting;
return;
}
+ (st.st_size - todo)), todo);
if (now == 0)
{
+ __close (fd);
free ((void *) catalog->file_ptr);
catalog->status = nonexisting;
return;