diff options
author | Wilco Baan Hofman <wilco@synlap.(none)> | 2008-04-15 11:52:33 +0200 |
---|---|---|
committer | Wilco Baan Hofman <wilco@synlap.(none)> | 2008-04-15 11:52:33 +0200 |
commit | 0b8d2b3cb779463a1e24039300ac2669862f9b64 (patch) | |
tree | a8e638253e71008f75fbcd84b5fe5ad9717c9ef2 /source4/lib/registry/patchfile_preg.c | |
parent | a31b6607f22f6b3e1b354db2f9f611b299a2f7ae (diff) | |
download | samba-0b8d2b3cb779463a1e24039300ac2669862f9b64.tar.gz samba-0b8d2b3cb779463a1e24039300ac2669862f9b64.tar.bz2 samba-0b8d2b3cb779463a1e24039300ac2669862f9b64.zip |
Fixed the patchfile tests and tidy up the patchfile backends.
(This used to be commit 6e9b1e35a269af2eda79356c1525f5413656d648)
Diffstat (limited to 'source4/lib/registry/patchfile_preg.c')
-rw-r--r-- | source4/lib/registry/patchfile_preg.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source4/lib/registry/patchfile_preg.c b/source4/lib/registry/patchfile_preg.c index 5216a04c8b..a28096517c 100644 --- a/source4/lib/registry/patchfile_preg.c +++ b/source4/lib/registry/patchfile_preg.c @@ -2,7 +2,7 @@ Unix SMB/CIFS implementation. Reading Registry.pol PReg registry files - Copyright (C) Wilco Baan Hofman 2006 + Copyright (C) Wilco Baan Hofman 2006-2008 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -71,7 +71,7 @@ static WERROR reg_preg_diff_del_all_values(void *_data, const char *key_name) static WERROR reg_preg_diff_done(void *_data) { struct preg_data *data = (struct preg_data *)_data; - + close(data->fd); talloc_free(data); return WERR_OK; @@ -95,15 +95,15 @@ _PUBLIC_ WERROR reg_preg_diff_save(TALLOC_CTX *ctx, const char *filename, *callback_data = data; if (filename) { - data->fd = open(filename, O_CREAT, 0755); - if (data->fd == -1) { + data->fd = open(filename, O_CREAT|O_WRONLY, 0755); + if (data->fd < 0) { DEBUG(0, ("Unable to open %s\n", filename)); return WERR_BADFILE; } } else { data->fd = STDOUT_FILENO; } - snprintf(preg_header.hdr, 4, "PReg"); + memcpy(preg_header.hdr, "PReg", 4); SIVAL(&preg_header, 4, 1); write(data->fd, (uint8_t *)&preg_header,8); |