pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/x11/libxshmfence/files



Module Name:    pkgsrc
Committed By:   tnn
Date:           Sun Feb 23 18:26:59 UTC 2020

Modified Files:
        pkgsrc/x11/libxshmfence/files: xshmfence_semaphore.c

Log Message:
silence format string warning


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 pkgsrc/x11/libxshmfence/files/xshmfence_semaphore.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/x11/libxshmfence/files/xshmfence_semaphore.c
diff -u pkgsrc/x11/libxshmfence/files/xshmfence_semaphore.c:1.6 pkgsrc/x11/libxshmfence/files/xshmfence_semaphore.c:1.7
--- pkgsrc/x11/libxshmfence/files/xshmfence_semaphore.c:1.6     Wed Aug 24 07:16:22 2016
+++ pkgsrc/x11/libxshmfence/files/xshmfence_semaphore.c Sun Feb 23 18:26:59 2020
@@ -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 xshmfen
 }
 
 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) {



Home | Main Index | Thread Index | Old Index