summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-12-08 16:05:08 +0100
committerMichael Adam <obnox@samba.org>2011-12-15 16:00:46 +0100
commitdaa365493e3fd7b7a664628e48438e7938fa4628 (patch)
tree8fab0eb82162ff40371befa4e694279f26baa290 /source3/lib
parent29f62bbed792da4236a299100d0e227df5e423a5 (diff)
downloadsamba-daa365493e3fd7b7a664628e48438e7938fa4628.tar.gz
samba-daa365493e3fd7b7a664628e48438e7938fa4628.tar.bz2
samba-daa365493e3fd7b7a664628e48438e7938fa4628.zip
s3-dbwrap: For nostalgic reasons, make dbwrap_file.c compile at least
Signed-off-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/dbwrap/dbwrap_file.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/source3/lib/dbwrap/dbwrap_file.c b/source3/lib/dbwrap/dbwrap_file.c
index 8e5bcd4f83..f7d207be7f 100644
--- a/source3/lib/dbwrap/dbwrap_file.c
+++ b/source3/lib/dbwrap/dbwrap_file.c
@@ -18,7 +18,10 @@
*/
#include "includes.h"
+#include "dbwrap/dbwrap.h"
#include "dbwrap/dbwrap_file.h"
+#include "dbwrap/dbwrap_private.h"
+#include "lib/util/tdb_wrap.h"
struct db_file_ctx {
const char *dirname;
@@ -75,7 +78,6 @@ static struct db_record *db_file_fetch_locked(struct db_context *db,
struct db_locked_file *file;
struct flock fl;
SMB_STRUCT_STAT statbuf;
- ssize_t nread;
int ret;
SMB_ASSERT(ctx->locked_record == NULL);
@@ -151,14 +153,14 @@ static struct db_record *db_file_fetch_locked(struct db_context *db,
return NULL;
}
- if (sys_fstat(file->fd, &statbuf) != 0) {
+ if (sys_fstat(file->fd, &statbuf, false) != 0) {
DEBUG(3, ("Could not fstat %s: %s\n",
file->path, strerror(errno)));
TALLOC_FREE(result);
return NULL;
}
- if (statbuf.st_nlink == 0) {
+ if (statbuf.st_ex_nlink == 0) {
/* Someone has deleted it under the lock, retry */
TALLOC_FREE(result);
goto again;
@@ -167,20 +169,23 @@ static struct db_record *db_file_fetch_locked(struct db_context *db,
result->value.dsize = 0;
result->value.dptr = NULL;
- if (statbuf.st_size != 0) {
- result->value.dsize = statbuf.st_size;
+ if (statbuf.st_ex_size != 0) {
+ NTSTATUS status;
+
+ result->value.dsize = statbuf.st_ex_size;
result->value.dptr = talloc_array(result, uint8,
- statbuf.st_size);
+ statbuf.st_ex_size);
if (result->value.dptr == NULL) {
DEBUG(1, ("talloc failed\n"));
TALLOC_FREE(result);
return NULL;
}
- nread = read_data(file->fd, (char *)result->value.dptr,
+ status = read_data(file->fd, (char *)result->value.dptr,
result->value.dsize);
- if (nread != result->value.dsize) {
- DEBUG(3, ("read_data failed: %s\n", strerror(errno)));
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(3, ("read_data failed: %s\n",
+ nt_errstr(status)));
TALLOC_FREE(result);
return NULL;
}