mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
cov: replace strcat with safe snprintf
This commit is contained in:
parent
4761753a6f
commit
db40a2e33c
@ -159,10 +159,9 @@ static int _do_flock(const char *file, int *fd, int operation, uint32_t nonblock
|
|||||||
static int _do_write_priority_flock(const char *file, int *fd, int operation, uint32_t nonblock)
|
static int _do_write_priority_flock(const char *file, int *fd, int operation, uint32_t nonblock)
|
||||||
{
|
{
|
||||||
int r, fd_aux = -1;
|
int r, fd_aux = -1;
|
||||||
char *file_aux = alloca(strlen(file) + sizeof(AUX_LOCK_SUFFIX));
|
char file_aux[PATH_MAX];
|
||||||
|
|
||||||
strcpy(file_aux, file);
|
snprintf(file_aux, sizeof(file_aux), "%s%s", file, AUX_LOCK_SUFFIX);
|
||||||
strcat(file_aux, AUX_LOCK_SUFFIX);
|
|
||||||
|
|
||||||
if ((r = _do_flock(file_aux, &fd_aux, LOCK_EX, nonblock))) {
|
if ((r = _do_flock(file_aux, &fd_aux, LOCK_EX, nonblock))) {
|
||||||
if (operation == LOCK_EX) {
|
if (operation == LOCK_EX) {
|
||||||
|
Loading…
Reference in New Issue
Block a user