Skip to content
Snippets Groups Projects
Commit 804a9b4f authored by Emma Anholt's avatar Emma Anholt Committed by Peter Hutterer
Browse files

shm: reindent shm_tmpfile to follow our standards.


Signed-off-by: default avatarEric Anholt <eric@anholt.net>
parent b8b64cd6
No related branches found
No related tags found
1 merge request!19Runtime shmdir
......@@ -1195,34 +1195,34 @@ static int
shm_tmpfile(void)
{
#ifdef SHMDIR
int fd;
char template[] = SHMDIR "/shmfd-XXXXXX";
int fd;
char template[] = SHMDIR "/shmfd-XXXXXX";
#ifdef O_TMPFILE
fd = open(SHMDIR, O_TMPFILE|O_RDWR|O_CLOEXEC|O_EXCL, 0666);
if (fd >= 0) {
DebugF ("Using O_TMPFILE\n");
return fd;
}
ErrorF ("Not using O_TMPFILE\n");
fd = open(SHMDIR, O_TMPFILE|O_RDWR|O_CLOEXEC|O_EXCL, 0666);
if (fd >= 0) {
DebugF ("Using O_TMPFILE\n");
return fd;
}
ErrorF ("Not using O_TMPFILE\n");
#endif
#ifdef HAVE_MKOSTEMP
fd = mkostemp(template, O_CLOEXEC);
fd = mkostemp(template, O_CLOEXEC);
#else
fd = mkstemp(template);
fd = mkstemp(template);
#endif
if (fd < 0)
return -1;
unlink(template);
if (fd < 0)
return -1;
unlink(template);
#ifndef HAVE_MKOSTEMP
int flags = fcntl(fd, F_GETFD);
if (flags != -1) {
flags |= FD_CLOEXEC;
(void) fcntl(fd, F_SETFD, &flags);
}
int flags = fcntl(fd, F_GETFD);
if (flags != -1) {
flags |= FD_CLOEXEC;
(void) fcntl(fd, F_SETFD, &flags);
}
#endif
return fd;
return fd;
#else
return -1;
return -1;
#endif
}
......
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