unsigned crypt_getpagesize(void)
{
- return (unsigned)sysconf(_SC_PAGESIZE);
+ long r = sysconf(_SC_PAGESIZE);
+ return r < 0 ? DEFAULT_MEM_ALIGNMENT : r;
}
static int get_alignment(int fd)
memcpy(hangover_buf, (char*)buf + solid, hangover);
r = write(fd, hangover_buf, bsize);
- if (r < 0 || r != bsize)
+ if (r < 0 || r < hangover)
goto out;
}
ret = count;
if (!hangover_buf)
goto out;
r = read(fd, hangover_buf, bsize);
- if (r < 0 || r != bsize)
+ if (r < 0 || r < hangover)
goto out;
memcpy((char *)buf + solid, hangover_buf, hangover);
log_err(ctx, _("Cannot get process priority.\n"));
else
if (setpriority(PRIO_PROCESS, 0, DEFAULT_PROCESS_PRIORITY))
- log_err(ctx, _("setpriority %d failed: %s\n"),
+ log_dbg("setpriority %d failed: %s",
DEFAULT_PROCESS_PRIORITY, strerror(errno));
}
return _memlock_count ? 1 : 0;
if (munlockall() == -1)
log_err(ctx, _("Cannot unlock memory.\n"));
if (setpriority(PRIO_PROCESS, 0, _priority))
- log_err(ctx, _("setpriority %d failed: %s\n"), _priority, strerror(errno));
+ log_dbg("setpriority %d failed: %s", _priority, strerror(errno));
}
return _memlock_count ? 1 : 0;
}