blob: 632ff1f50a1f631def297b4272b742a58f565aba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
/*
* License: BSD-style license
* Copyright: Radek Podgorny <radek@podgorny.cz>,
* Bernd Schubert <bernd.schubert@fastmail.fm>
*/
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include "opts.h"
#include "debug.h"
static char default_debug_path[] = "./unionfs_debug.log";
FILE* dbgfile = NULL;
int debug_init(void) {
char *dbgpath = uopt.dbgpath;
if (!dbgpath) dbgpath = default_debug_path;
printf("Debug mode, log will be written to %s\n", dbgpath);
dbgfile = fopen(dbgpath, "w");
if (!dbgfile) {
printf("Failed to open %s for writing: %s.\nAborting!\n",
dbgpath, strerror(errno));
RETURN(2);
}
RETURN(0);
}
|