summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-07-25 18:59:56 +0000
committerJeremy Allison <jra@samba.org>2001-07-25 18:59:56 +0000
commitac26e231394739abafd5f1f00722e44d6323de35 (patch)
tree3473e5d14f5b2c694a140ed08c7087a3d2570faa
parente662983fbe2068c977821f6563900d5a2b0a9323 (diff)
downloadsamba-ac26e231394739abafd5f1f00722e44d6323de35.tar.gz
samba-ac26e231394739abafd5f1f00722e44d6323de35.tar.bz2
samba-ac26e231394739abafd5f1f00722e44d6323de35.zip
Always check fstat for error.
Jeremy. (This used to be commit 34951876a1bfad5aa3fc3bd05b808e150f639a8a)
-rw-r--r--source3/tdb/tdb.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/source3/tdb/tdb.c b/source3/tdb/tdb.c
index c3ded6368b..940825e41d 100644
--- a/source3/tdb/tdb.c
+++ b/source3/tdb/tdb.c
@@ -127,14 +127,15 @@ struct list_struct {
u32 full_hash; /* the full 32 bit hash of the key */
u32 magic; /* try to catch errors */
/* the following union is implied:
- union {
- char record[rec_len];
- struct {
- char key[key_len];
- char data[data_len];
- }
- u32 totalsize; (tailer)
- } */
+ union {
+ char record[rec_len];
+ struct {
+ char key[key_len];
+ char data[data_len];
+ }
+ u32 totalsize; (tailer)
+ }
+ */
};
/* a byte range locking function - return 0 on success
@@ -144,7 +145,7 @@ static int tdb_brlock(TDB_CONTEXT *tdb, tdb_off offset,
{
struct flock fl;
- if (tdb->flags & TDB_NOLOCK) return 0;
+ if (tdb->flags & TDB_NOLOCK) return 0;
if (tdb->read_only) return -1;
fl.l_type = rw_type;
@@ -234,7 +235,9 @@ static int tdb_oob(TDB_CONTEXT *tdb, tdb_off len, int probe)
if (len <= tdb->map_size) return 0;
if (tdb->flags & TDB_INTERNAL) return 0;
- fstat(tdb->fd, &st);
+ if (fstat(tdb->fd, &st) == -1)
+ return TDB_ERRCODE(TDB_ERR_IO, -1);
+
if (st.st_size < (size_t)len) {
if (!probe) {
TDB_LOG((tdb, 0,"tdb_oob len %d beyond eof at %d\n",