Skip to content

Commit 2d6e2ca

Browse files
committed
Merge PR ceph#65715 into main
* refs/pull/65715/head: common/compat: resolve signedness warnings common/compat: resolve unused label warnings Reviewed-by: Edwin Rodriguez <[email protected]>
2 parents 2aa9727 + 4f0f396 commit 2d6e2ca

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

.githubmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,3 +201,4 @@ Shwetha-Acharya Shwetha Acharya <[email protected]>
201201
xhernandez Xavi Hernandez <[email protected]>
202202
ThomasLamprecht Thomas Lamprecht <[email protected]>
203203
jmundack Joseph Mundackal <[email protected]>
204+
edwinzrodriguez Edwin Rodriguez <[email protected]>

src/common/compat.cc

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ int pipe_cloexec(int pipefd[2], int flags)
118118
if (pipe(pipefd) == -1)
119119
return -1;
120120

121-
#ifndef _WIN32
121+
# ifdef _WIN32
122+
return 0;
123+
# else
122124
/*
123125
* The old-fashioned, race-condition prone way that we have to fall
124126
* back on if pipe2 does not exist.
@@ -130,14 +132,15 @@ int pipe_cloexec(int pipefd[2], int flags)
130132
if (fcntl(pipefd[1], F_SETFD, FD_CLOEXEC) < 0) {
131133
goto fail;
132134
}
133-
#endif
134135

135136
return 0;
137+
136138
fail:
137139
int save_errno = errno;
138140
VOID_TEMP_FAILURE_RETRY(close(pipefd[0]));
139141
VOID_TEMP_FAILURE_RETRY(close(pipefd[1]));
140142
return (errno = save_errno, -1);
143+
# endif
141144
#endif
142145
}
143146

@@ -151,16 +154,17 @@ int socket_cloexec(int domain, int type, int protocol)
151154
if (fd == -1)
152155
return -1;
153156

154-
#ifndef _WIN32
157+
# ifdef _WIN32
158+
return fd;
159+
# else
155160
if (fcntl(fd, F_SETFD, FD_CLOEXEC) < 0)
156161
goto fail;
157-
#endif
158-
159162
return fd;
160163
fail:
161164
int save_errno = errno;
162165
VOID_TEMP_FAILURE_RETRY(close(fd));
163166
return (errno = save_errno, -1);
167+
# endif
164168
#endif
165169
}
166170

@@ -202,16 +206,18 @@ int accept_cloexec(int sockfd, struct sockaddr* addr, socklen_t* addrlen)
202206
if (fd == -1)
203207
return -1;
204208

205-
#ifndef _WIN32
209+
# ifdef _WIN32
210+
return fd;
211+
# else
206212
if (fcntl(fd, F_SETFD, FD_CLOEXEC) < 0)
207213
goto fail;
208-
#endif
209214

210215
return fd;
211216
fail:
212217
int save_errno = errno;
213218
VOID_TEMP_FAILURE_RETRY(close(fd));
214219
return (errno = save_errno, -1);
220+
# endif
215221
#endif
216222
}
217223

@@ -363,7 +369,7 @@ ssize_t preadv(int fd, const struct iovec *iov, int iov_cnt) {
363369
if (r < 0)
364370
return r;
365371
read += r;
366-
if (r < iov[i].iov_len)
372+
if ((unsigned)r < iov[i].iov_len)
367373
break;
368374
}
369375

@@ -378,7 +384,7 @@ ssize_t writev(int fd, const struct iovec *iov, int iov_cnt) {
378384
if (r < 0)
379385
return r;
380386
written += r;
381-
if (r < iov[i].iov_len)
387+
if ((unsigned)r < iov[i].iov_len)
382388
break;
383389
}
384390

0 commit comments

Comments
 (0)