Switch to unified view

a/src/utils/readfile.cpp b/src/utils/readfile.cpp
1
#ifndef lint
1
#ifndef lint
2
static char rcsid[] = "@(#$Id: readfile.cpp,v 1.5 2007-09-08 08:07:05 dockes Exp $ (C) 2004 J.F.Dockes";
2
static char rcsid[] = "@(#$Id: readfile.cpp,v 1.6 2007-09-08 09:44:43 dockes Exp $ (C) 2004 J.F.Dockes";
3
#endif
3
#endif
4
/*
4
/*
5
 *   This program is free software; you can redistribute it and/or modify
5
 *   This program is free software; you can redistribute it and/or modify
6
 *   it under the terms of the GNU General Public License as published by
6
 *   it under the terms of the GNU General Public License as published by
7
 *   the Free Software Foundation; either version 2 of the License, or
7
 *   the Free Software Foundation; either version 2 of the License, or
...
...
32
32
33
#include "readfile.h"
33
#include "readfile.h"
34
34
35
static void caterrno(string *reason)
35
static void caterrno(string *reason)
36
{
36
{
37
#define ERRBUFSZ 200    
38
    char errbuf[ERRBUFSZ];
37
  if (reason) {
39
  if (reason) {
38
#ifdef sun
40
#ifdef sun
39
    // Note: sun strerror is noted mt-safe ??
41
    // Note: sun strerror is noted mt-safe ??
40
    *reason += string("file_to_string: open failed: ") + strerror(errno);
42
    *reason += string("file_to_string: open failed: ") + strerror(errno);
41
#else
43
#else
...
...
45
  }
47
  }
46
}
48
}
47
49
48
bool file_to_string(const string &fn, string &data, string *reason)
50
bool file_to_string(const string &fn, string &data, string *reason)
49
{
51
{
50
#define ERRBUFSZ 200    
51
    char errbuf[ERRBUFSZ];
52
    bool ret = false;
52
    bool ret = false;
53
53
54
    int fd = open(fn.c_str(), O_RDONLY|O_STREAMING);
54
    int fd = open(fn.c_str(), O_RDONLY|O_STREAMING);
55
    if (fd < 0) {
55
    if (fd < 0) {
56
        caterrno(reason);
56
        caterrno(reason);