From: Samuel Just Date: Wed, 31 Aug 2011 21:47:18 +0000 (-0700) Subject: FlatIndex: lfn_get needs to set *exist for short filenames X-Git-Tag: v0.35~151 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bcef985deb319bb915f36d96c8668d37c2c4dbcd;p=ceph.git FlatIndex: lfn_get needs to set *exist for short filenames Signed-off-by: Samuel Just --- diff --git a/src/os/FlatIndex.cc b/src/os/FlatIndex.cc index 10dd48f1e587..f3b0cb3d2a57 100644 --- a/src/os/FlatIndex.cc +++ b/src/os/FlatIndex.cc @@ -220,6 +220,18 @@ static int lfn_get(const char *coll_path, const hobject_t& oid, char *pathname, /* not a long file name, just build it as it is */ strncpy(filename, lfn, len - path_len); *is_lfn = 0; + struct stat buf; + int r = ::stat(pathname, &buf); + if (r < 0) { + if (errno == ENOENT) { + *exist = 0; + } else { + return -errno; + } + } else { + *exist = 1; + } + return 0; } @@ -290,7 +302,6 @@ int FlatIndex::unlink(const hobject_t &o) { if (!is_lfn) { r = ::unlink(short_fn); if (r < 0) { - cerr << "failed to unlink: " << short_fn << std::endl; return -errno; } return 0;