- if ((fd = open(fname, readonly? O_RDONLY : (O_RDWR|O_CREAT))) < 0) {
- xlog(L_WARNING, "could not open %s for locking", fname);
+ if (readonly)
+ fd = open(fname, (O_RDONLY|O_CREAT), 0600);
+ else
+ fd = open(fname, (O_RDWR|O_CREAT), 0600);
+ if (fd < 0) {
+ xlog(L_WARNING, "could not open %s for locking: errno %d (%s)",
+ fname, errno, strerror(errno));