diff options
author | tnn <tnn@pkgsrc.org> | 2020-02-23 18:26:59 +0000 |
---|---|---|
committer | tnn <tnn@pkgsrc.org> | 2020-02-23 18:26:59 +0000 |
commit | 8670bd4e118b1a58e39a3fdd3e4ad26fab636e73 (patch) | |
tree | 7d0c958827ffe357353370548920247326cd5062 | |
parent | fa933f8d60c24e327c8acfc011b1b6c8d7d416a0 (diff) | |
download | pkgsrc-8670bd4e118b1a58e39a3fdd3e4ad26fab636e73.tar.gz |
silence format string warning
-rw-r--r-- | x11/libxshmfence/files/xshmfence_semaphore.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/x11/libxshmfence/files/xshmfence_semaphore.c b/x11/libxshmfence/files/xshmfence_semaphore.c index c1728177ee5..a2d39aa3ac9 100644 --- a/x11/libxshmfence/files/xshmfence_semaphore.c +++ b/x11/libxshmfence/files/xshmfence_semaphore.c @@ -159,12 +159,12 @@ xshmfence_init(int fd) __sync_fetch_and_and(&f.triggered, 0); __sync_fetch_and_and(&f.waiting, 0); - lock = mksemtemp(f.lockname, sizeof(f.lockname) - 1, "/xshmfl-%i"); + lock = mksemtemp(f.lockname, sizeof(f.lockname), "l"); if (lock == SEM_FAILED) { err(EXIT_FAILURE, "xshmfence_init: sem_open"); } - cond = mksemtemp(f.condname, sizeof(f.condname) - 1, "/xshmfc-%i"); + cond = mksemtemp(f.condname, sizeof(f.condname), "c"); if (cond == SEM_FAILED) { err(EXIT_FAILURE, "xshmfence_init: sem_open"); } @@ -223,13 +223,14 @@ xshmfence_close_semaphore(struct xshmfence *f) } static sem_t * -mksemtemp(char *name, size_t namelen, const char *template) +mksemtemp(char *name, size_t namelen, const char *suffix) { sem_t *ret; pid_t p; p = getpid(); for(;;) { - snprintf(name, namelen, template, p); + if (snprintf(name, namelen, "/xshmf%s-%d", suffix, p) >= namelen) + return SEM_FAILED; ret = sem_open(name, O_CREAT|O_EXCL, 0600, 1); if (ret == SEM_FAILED) { if (errno == EEXIST) { |