diff options
| author | Richard Nyberg <rnyberg@murmeldjur.se> | 2007-02-25 17:38:21 +0000 |
|---|---|---|
| committer | Richard Nyberg <rnyberg@murmeldjur.se> | 2007-02-25 17:38:21 +0000 |
| commit | 564fe5afe1e690f39380cdb20695294c32c05b58 (patch) | |
| tree | c830d7371bafc12571af69dfa387265a9e7f50f1 | |
| parent | 91f85c222be7ef247c8f2e18815eb23c336ed081 (diff) | |
| download | btpd-564fe5afe1e690f39380cdb20695294c32c05b58.tar.gz btpd-564fe5afe1e690f39380cdb20695294c32c05b58.zip | |
Some better logging.
| -rw-r--r-- | btpd/content.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/btpd/content.c b/btpd/content.c index bf6caed..1879b3f 100644 --- a/btpd/content.c +++ b/btpd/content.c @@ -373,14 +373,23 @@ again: if (stat(path, &sb) == -1) { if (errno == ENOENT) { errno = vopen(&fd, O_CREAT|O_RDWR, "%s", path); - if (errno != 0 || close(fd) != 0) + if (errno != 0 || close(fd) != 0) { + btpd_log(BTPD_L_ERROR, "failed to create '%s' (%s).\n", + path, strerror(errno)); return errno; + } goto again; - } else + } else { + btpd_log(BTPD_L_ERROR, "failed to stat '%s' (%s).\n", + path, strerror(errno)); return errno; + } } else if (sb.st_size > tp->files[i].length) { - if (truncate(path, tp->files[i].length) != 0) + if (truncate(path, tp->files[i].length) != 0) { + btpd_log(BTPD_L_ERROR, "failed to truncate '%s' (%s).\n", + path, strerror(errno)); return errno; + } goto again; } else { ret[i].mtime = sb.st_mtime; @@ -514,8 +523,6 @@ cm_start(struct torrent *tp, int force_test) fts = btpd_calloc(tp->nfiles * 2, sizeof(*fts)); if ((err = stat_and_adjust(tp, fts)) != 0) { - btpd_log(BTPD_L_ERROR, "failed stat_and_adjust for '%s' (%s).\n", - torrent_name(tp), strerror(err)); free(fts); cm_on_error(tp); return; |