Switch to unified view

a/src/utils/copyfile.cpp b/src/utils/copyfile.cpp
...
...
30
#endif
30
#endif
31
31
32
#include <cstring>
32
#include <cstring>
33
33
34
#include "copyfile.h"
34
#include "copyfile.h"
35
#include "debuglog.h"
35
#include "log.h"
36
36
37
using namespace std;
37
using namespace std;
38
38
39
#define CPBSIZ 8192
39
#define CPBSIZ 8192
40
40
...
...
44
    int dfd = -1;
44
    int dfd = -1;
45
    bool ret = false;
45
    bool ret = false;
46
    char buf[CPBSIZ];
46
    char buf[CPBSIZ];
47
    int oflags = O_WRONLY|O_CREAT|O_TRUNC|O_BINARY;
47
    int oflags = O_WRONLY|O_CREAT|O_TRUNC|O_BINARY;
48
48
49
    LOGDEB(("copyfile: %s to %s\n", src, dst));
49
    LOGDEB("copyfile: "  << (src) << " to "  << (dst) << "\n" );
50
50
51
    if ((sfd = ::open(src, O_RDONLY, 0)) < 0) {
51
    if ((sfd = ::open(src, O_RDONLY, 0)) < 0) {
52
        reason += string("open ") + src + ": " + strerror(errno);
52
        reason += string("open ") + src + ": " + strerror(errno);
53
        goto out;
53
        goto out;
54
    }
54
    }
...
...
92
}
92
}
93
93
94
bool stringtofile(const string& dt, const char *dst, string& reason,
94
bool stringtofile(const string& dt, const char *dst, string& reason,
95
                  int flags)
95
                  int flags)
96
{
96
{
97
    LOGDEB(("stringtofile:\n"));
97
    LOGDEB("stringtofile:\n" );
98
    int dfd = -1;
98
    int dfd = -1;
99
    bool ret = false;
99
    bool ret = false;
100
    int oflags = O_WRONLY|O_CREAT|O_TRUNC|O_BINARY;
100
    int oflags = O_WRONLY|O_CREAT|O_TRUNC|O_BINARY;
101
101
102
    LOGDEB(("stringtofile: %u bytes to %s\n", (unsigned int)dt.size(), dst));
102
    LOGDEB("stringtofile: "  << ((unsigned int)dt.size()) << " bytes to "  << (dst) << "\n" );
103
103
104
    if (flags & COPYFILE_EXCL) {
104
    if (flags & COPYFILE_EXCL) {
105
        oflags |= O_EXCL;
105
        oflags |= O_EXCL;
106
    }
106
    }
107
107
...
...
260
        exit(0);
260
        exit(0);
261
    }
261
    }
262
}
262
}
263
263
264
#endif
264
#endif
265