pkgsrc-ng/sysutils/dptutil/patches/patch-dpteng_lockunix_c
2013-09-26 17:14:40 +02:00

29 lines
941 B
Plaintext

$NetBSD: patch-dpteng_lockunix_c,v 1.1 2011/05/22 19:11:42 dholland Exp $
- Avoid mktemp.
- Pass a file mode to open when creating files.
Note that dpteng/lockunix.c and dptutil/lockunix.c are identical and
should be patched identically.
--- dpteng/lockunix.c.orig 2002-08-13 15:02:26.000000000 +0000
+++ dpteng/lockunix.c
@@ -73,7 +73,7 @@ MkLock (char * name)
return (-1);
}
sprintf (templateBuffer, Template, Name);
- if ((fd = open(mktemp (templateBuffer), O_WRONLY|O_CREAT|O_EXCL)) < 0) {
+ if ((fd = mkstemp (templateBuffer)) < 0) {
free (templateBuffer);
free (lock);
return (-1);
@@ -143,7 +143,7 @@ ChLock (char * name, int pid)
if (lock != (char *)NULL) {
sprintf (lock, Lock, Name);
- if ((fd = open(lock, O_WRONLY|O_CREAT|O_TRUNC)) >= 0) {
+ if ((fd = open(lock, O_WRONLY|O_CREAT|O_TRUNC, 0600)) >= 0) {
sprintf (buffer, "%d\n", pid);
write (fd, buffer, strlen(buffer));
close (fd);