Skip to content
Snippets Groups Projects
Commit bdcc5658 authored by Konstantin Osipov's avatar Konstantin Osipov
Browse files

Fix a few warnings of the release build.

parent 04f1ac51
No related branches found
No related tags found
No related merge requests found
......@@ -481,7 +481,10 @@ struct SetuidGuard
SetuidGuard::SetuidGuard(const char *name, uint32_t name_len,
struct user *user, uint8_t access)
:setuid(false)
,orig_auth_token(GUEST) /* silence gnu warning */
,orig_uid(GUEST)
{
/*
* If the user has universal access, don't bother with setuid.
* No special check for ADMIN user is necessary
......@@ -516,7 +519,7 @@ SetuidGuard::SetuidGuard(const char *name, uint32_t name_len,
}
if (func->setuid) {
/** Remember and change the current user id. */
setuid = func->setuid;
setuid = true;
orig_auth_token = user->auth_token;
orig_uid = user->uid;
session_set_user(session(), func->auth_token, func->uid);
......
......@@ -41,7 +41,8 @@ find_path(const char *argv0)
if (rc == -1)
snprintf(buf, sizeof(buf) - 1, "%s", getenv("_"));
}
realpath(buf, path);
if (realpath(buf, path) == NULL)
snprintf(path, sizeof(path), "%s", buf);
found = true;
return path;
}
......@@ -274,8 +274,8 @@ fiob_open(const char *path, const char *mode)
flags |= O_DIRECT;
#endif
bsize = O_DIRECT_BSIZE;
posix_memalign(&buf, 4096, bsize);
if (!buf) {
int res = posix_memalign(&buf, 4096, bsize);
if (res || !buf) {
errno = ENOMEM;
return NULL;
}
......
......@@ -44,7 +44,7 @@ munmap_checked(void *addr, size_t size)
{
if (munmap(addr, size)) {
char buf[64];
strerror_r(errno, buf, sizeof(buf));
(void) strerror_r(errno, buf, sizeof(buf));
fprintf(stderr, "Error in munmap(%p, %zu): %s\n",
addr, size, buf);
assert(false);
......
......@@ -54,7 +54,8 @@ random_init(void)
if (flags != -1)
fcntl(rfd, F_SETFD, flags | FD_CLOEXEC);
read(rfd, &seed, sizeof(seed));
ssize_t res = read(rfd, &seed, sizeof(seed));
(void) res;
srand:
srandom(seed);
srand(seed);
......
......@@ -506,7 +506,8 @@ tarantool_free(void)
if (time(NULL) == 0) {
/* never executed */
extern void *ffi_symbols[];
write(0, ffi_symbols, 0);
ssize_t res = write(0, ffi_symbols, 0);
(void) res;
}
}
......
......@@ -165,7 +165,8 @@ main(void)
done = 0;
for (i = 0; i < 1000000 + 1; i++) {
buf[0] = 0;
fgets(buf, 4096, f);
char *res = fgets(buf, 4096, f);
(void) res;
if (strcmp(buf, "Hello, world\n") == 0)
done++;
}
......@@ -195,12 +196,16 @@ main(void)
done = 0;
for (i = 0; i < 1000000 + 1; i++) {
memset(buf, 0, 4096);
fgets(buf, 4096, f);
char *res = fgets(buf, 4096, f);
(void) res;
if (strcmp(buf, "Hello, world\n") == 0)
done++;
/* else */
/* fprintf(stderr, "# wrong line %zu: %s", */
/* i, buf); */
#if 0
else {
fprintf(stderr, "# wrong line %zu: %s",
i, buf);
}
#endif
}
is(done, 1000000 + 1, "all records were written properly");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment