projects
/
cumulus.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
161345e
)
Clean up error reporting.
author
Michael Vrable
<mvrable@cs.ucsd.edu>
Fri, 11 May 2007 21:49:50 +0000
(14:49 -0700)
committer
Michael Vrable
<mvrable@turin.ucsd.edu>
Fri, 11 May 2007 21:49:50 +0000
(14:49 -0700)
scandir.cc
patch
|
blob
|
history
diff --git
a/scandir.cc
b/scandir.cc
index
2570be5
..
079324a
100644
(file)
--- a/
scandir.cc
+++ b/
scandir.cc
@@
-30,10
+30,10
@@
using std::ostream;
static TarSegmentStore *tss = NULL;
/* Buffer for holding a single block of data read from a file. */
static TarSegmentStore *tss = NULL;
/* Buffer for holding a single block of data read from a file. */
-static const
in
t LBS_BLOCK_SIZE = 1024 * 1024;
+static const
size_
t LBS_BLOCK_SIZE = 1024 * 1024;
static char *block_buf;
static char *block_buf;
-static const
in
t LBS_METADATA_BLOCK_SIZE = 65536;
+static const
size_
t LBS_METADATA_BLOCK_SIZE = 65536;
/* Contents of the root object. This will contain a set of indirect links to
* the metadata objects. */
/* Contents of the root object. This will contain a set of indirect links to
* the metadata objects. */
@@
-106,7
+106,7
@@
void dumpfile(int fd, dictionary &file_info)
list<string> object_list;
if ((stat_buf.st_mode & S_IFMT) != S_IFREG) {
list<string> object_list;
if ((stat_buf.st_mode & S_IFMT) != S_IFREG) {
-
printf(
"file is no longer a regular file!\n");
+
fprintf(stderr,
"file is no longer a regular file!\n");
return;
}
return;
}
@@
-216,16
+216,14
@@
void scanfile(const string& path)
buf = new char[stat_buf.st_size + 2];
len = readlink(path.c_str(), buf, stat_buf.st_size + 1);
if (len < 0) {
buf = new char[stat_buf.st_size + 2];
len = readlink(path.c_str(), buf, stat_buf.st_size + 1);
if (len < 0) {
-
printf(
"error reading symlink: %m\n");
+
fprintf(stderr,
"error reading symlink: %m\n");
} else if (len <= stat_buf.st_size) {
buf[len] = '\0';
} else if (len <= stat_buf.st_size) {
buf[len] = '\0';
-
printf(" contents=%s\n",
buf);
+
file_info["contents"] = uri_encode(
buf);
} else if (len > stat_buf.st_size) {
} else if (len > stat_buf.st_size) {
-
printf(
"error reading symlink: name truncated\n");
+
fprintf(stderr,
"error reading symlink: name truncated\n");
}
}
- file_info["contents"] = uri_encode(buf);
-
delete[] buf;
break;
case S_IFREG:
delete[] buf;
break;
case S_IFREG:
@@
-284,7
+282,7
@@
void scandir(const string& path)
DIR *dir = opendir(path.c_str());
if (dir == NULL) {
DIR *dir = opendir(path.c_str());
if (dir == NULL) {
-
printf(
"Error: %m\n");
+
fprintf(stderr,
"Error: %m\n");
return;
}
return;
}