Actions
Fix #3180
closeduse of strerror() for possibly-negative return values
Status:
Rejected
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
% Done:
0%
Source:
Development
Tags:
Backport:
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):
Description
System calls and similar routines throughout Ceph use negative constant return codes
to indicate error; strerror() is specified to take a positive value. cpp_strerror()
exists for this, and should be used.
Updated by Sage Weil about 11 years ago
- Translation missing: en.field_story_points set to 1.00
Updated by Loïc Dachary over 9 years ago
- Status changed from New to Rejected
I could not find an instance where strerror is used instead of cpp_strerror in the current master
src/btrfs_ioc_test.c:53: rc, strerror(rc)); src/client/hypertable/CephBroker.cc:46:/* A thread-safe version of strerror */ src/client/hypertable/CephBroker.cc:53: oss << strerror_r(err, buf, sizeof(buf)); src/client/hypertable/CephBroker.cc:521: strerror_r(error, errbuf, 128); src/common/errno.cc:19: // strerror_r returns char * on Linux, and does not always fill buf src/common/errno.cc:20:#ifdef STRERROR_R_CHAR_P src/common/errno.cc:21: errmsg = strerror_r(err, buf, sizeof(buf)); src/common/errno.cc:23: strerror_r(err, buf, sizeof(buf)); src/common/module.c:44: strerror_r(errno, error_buf, sizeof(error_buf))); src/common/secret.c:70: strerror_r(-ret, error_buf, sizeof(error_buf))); src/common/secret.c:118: strerror_r(-ret, error_buf, sizeof(error_buf))); src/gtest/include/gtest/internal/gtest-port.h:1337:// StrError() aren't needed on Windows CE at this time and thus not src/gtest/include/gtest/internal/gtest-port.h:1361:inline const char* StrError(int errnum) { return strerror(errnum); } src/gtest/src/gtest-death-test.cc:252: return String(errno == 0 ? "" : posix::StrError(errno)); src/gtest/src/gtest.cc:3084: // we need the strerror_r() function, which is not available on src/java/native/libcephfs_jni.cc:234: THROW(env, "java/io/IOException", strerror(-rc)); src/mount/mount.ceph.c:356: printf("mount error %d = %s\n",errno,strerror(errno)); src/mount/mtab.c:163: linktargetfile, strerror (errsv)); src/mount/mtab.c:189: _PATH_MOUNTED_LOCK, strerror (errsv)); src/mount/mtab.c:205: _PATH_MOUNTED_LOCK, strerror (errsv)); src/mount/mtab.c:229: "timed out" : strerror (errsv)); src/mount/mtab.c:267: strerror (errsv)); src/mount/mtab.c:272: _PATH_MOUNTED, strerror (errsv)); src/rbd_fuse/rbd-fuse.c:741: fprintf(stderr, "%s: %s\n", msg, strerror(-err)); src/rbd_replay/actions.cc:345: << ": (" << -r << ") " << strerror(-r) << std::endl; src/test/fsx.c:146: fprintf(stderr, "%s\n", strerror(code)); src/test/fsx.c:179: prt("%s%s%s\n", prefix, prefix ? ": " : "", strerror(errno)); src/test/librbd/fsx.c:185: fprintf(stderr, "%s\n", strerror(code)); src/test/librbd/fsx.c:215: prt("%s%s%s\n", prefix, prefix ? ": " : "", strerror(errno)); src/test/librbd/fsx.c:221: prt("%s%s%s\n", prefix, prefix ? ": " : "", strerror(-code)); src/test/librbd/fsx.c:227: fprintf(stderr, "%s: %s\n", msg, strerror(-err)); src/test/librbd/fsx.c:1820: strerror(ret)); src/test/librbd/fsx.c:1847: strerror(ret)); src/test/librbd/fsx.c:1858: strerror(-ret)); src/test/librbd/fsx.c:1876: strerror(-res)); src/test/old/test_seek_read.c:48: if (r < 0) cout << "r = " << r << " " << strerror(errno) << endl; src/test/old/test_short_seek_read.c:47: if (r < 0) cout << "r = " << r << " " << strerror(errno) << endl; src/test/old/testxattr.cc:24: cout << "errno " << errno << " " << strerror(errno) << endl; src/test/old/testxattr.cc:26: cout << "errno " << errno << " " << strerror(errno) << endl; src/test/test_get_blkdev_size.cc:28: fprintf(stderr, "get_block_device_size: %s\n", strerror(-ret));
Updated by Dan Mick over 9 years ago
Yeah, I actually fixed this, and forgot the bug still existed.
Actions