aa5981f9d4
least minimal comments to all patches and tidy up some (but by no means all) pkglint. I have no idea if this works. It spews warnings about "packed", which lead me to suspect it may not run correctly, but I don't have the facilities to test it. It does, however, now build ok on LP64 and if someone can test it may be reasonable to remove the restriction on that.
28 lines
941 B
Text
28 lines
941 B
Text
$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);
|