diff options
Diffstat (limited to 'source3/lib/util_file.c')
-rw-r--r-- | source3/lib/util_file.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source3/lib/util_file.c b/source3/lib/util_file.c index 77c0d7888e..5ecf526280 100644 --- a/source3/lib/util_file.c +++ b/source3/lib/util_file.c @@ -573,3 +573,20 @@ void file_lines_slashcont(char **lines) } } } + +/* + save a lump of data into a file. Mostly used for debugging +*/ +BOOL file_save(const char *fname, void *packet, size_t length) +{ + int fd; + fd = open(fname, O_WRONLY|O_CREAT|O_TRUNC, 0644); + if (fd == -1) { + return False; + } + if (write(fd, packet, length) != length) { + return False; + } + close(fd); + return True; +} |