diff --git a/src/files.c b/src/files.c index 00d539b3f..20b80ef6e 100644 --- a/src/files.c +++ b/src/files.c @@ -34,7 +34,7 @@ extern int errno; #endif #ifdef PREFIXES_IN_USE -#define FQN_NUMBUF 2 +#define FQN_NUMBUF 3 static char fqn_filename_buffer[FQN_NUMBUF][FQN_MAX_FILENAME]; #endif @@ -909,7 +909,7 @@ int retryct; lockname = make_lockname(filename, locknambuf); filename = fqname(filename, whichprefix, 0); #ifndef NO_FILE_LINKS /* LOCKDIR should be subsumed by LOCKPREFIX */ - lockname = fqname(lockname, LOCKPREFIX, 1); + lockname = fqname(lockname, LOCKPREFIX, 2); #endif #if defined(UNIX) || defined(VMS) @@ -1013,7 +1013,7 @@ const char *filename; if (nesting == 1) { lockname = make_lockname(filename, locknambuf); #ifndef NO_FILE_LINKS /* LOCKDIR should be subsumed by LOCKPREFIX */ - lockname = fqname(lockname, LOCKPREFIX, 1); + lockname = fqname(lockname, LOCKPREFIX, 2); #endif #if defined(UNIX) || defined(VMS) diff --git a/sys/share/pcunix.c b/sys/share/pcunix.c index 2ec56227a..ee112821d 100644 --- a/sys/share/pcunix.c +++ b/sys/share/pcunix.c @@ -96,7 +96,7 @@ eraseoldlocks() void getlock() { - register int fd, c, ci, ct; + register int fd, c, ci, ct, ern; char tbuf[BUFSZ]; const char *fq_lock; # if defined(MSDOS) && defined(NO_TERMS) @@ -180,10 +180,17 @@ getlock() gotlock: fd = creat(fq_lock, FCMASK); + if (fd == -1) ern = errno; unlock_file(HLOCK); if(fd == -1) { chdirx(orgdir, 0); - error("cannot creat lock file (%s.)", fq_lock); +#if defined(WIN32) + error("cannot creat file (%s.)\n%s\n%s\"%s\" exists?\n", + fq_lock, strerror(ern), "Are you sure that the directory", + fqn_prefix[LEVELPREFIX]); +#else + error("cannot creat file (%s.)", fq_lock); +#endif } else { if(write(fd, (char *) &hackpid, sizeof(hackpid)) != sizeof(hackpid)){