From a6ef73359c0e0537ebf83795ebacbbfaee2c9c28 Mon Sep 17 00:00:00 2001 From: pancake Date: Fri, 19 Dec 2008 19:39:27 +0100 Subject: * Apply security patches from Erik Hovland - Thanks! --- src/squeue/squeue.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/squeue/squeue.c') diff --git a/src/squeue/squeue.c b/src/squeue/squeue.c index 96f2b59..89fc7f5 100644 --- a/src/squeue/squeue.c +++ b/src/squeue/squeue.c @@ -40,13 +40,18 @@ struct squeue_t *squeue_open(const char *file, int mode) struct squeue_t *q; char *pool; int shmid; + int fd; key_t k; k = ftok(file, 0x34); if (k == -1) { perror("ftok"); squeue_release(file); - close(creat(file, 0666)); + if ((fd = creat(file, 0666)) == -1) { + perror("creat"); + return NULL; + } + close(fd); chmod(file, 0666); k = ftok(file, 0xa3); if (k == -1) { -- cgit v1.2.3