string banner = (format == 1 ? utils::RBD_DIFF_BANNER : utils::RBD_DIFF_BANNER_V2);
char buf[banner.size() + 1];
- bool from_stdin = (fd == 0);
+ bool from_stdin = (fd == STDIN_FILENO);
if (!from_stdin) {
r = ::fstat(fd, &stat_buf);
if (r < 0)
int fd;
if (strcmp(path, "-") == 0) {
- fd = 0;
+ fd = STDIN_FILENO;
} else {
fd = open(path, O_RDONLY);
if (fd < 0) {
if (import_format == 1)
return r;
- if (fd == 0 || size < utils::RBD_IMAGE_BANNER_V2.size()) {
+ if (fd == STDIN_FILENO || size < utils::RBD_IMAGE_BANNER_V2.size()) {
r = -EINVAL;
return r;
}
size_t blklen = 0; // amount accumulated from reads to fill blk
char *p = new char[imgblklen];
uint64_t image_pos = 0;
- bool from_stdin = (fd == 0);
+ bool from_stdin = (fd == STDIN_FILENO);
reqlen = min(reqlen, size);
// loop body handles 0 return, as we may have a block to flush
goto out;
}
- if (fd == 0) {
+ if (fd == STDIN_FILENO) {
r = image.resize(image_pos);
if (r < 0) {
std::cerr << "rbd: final image resize failed" << std::endl;
bool from_stdin = !strcmp(path, "-");
if (from_stdin) {
throttle.reset(new SimpleThrottle(1, false));
- fd = 0;
+ fd = STDIN_FILENO;
size = 1ULL << order;
} else {
throttle.reset(new SimpleThrottle(