Thread View: comp.mail.mush
1 messages
1 total messages
Started by Barton E. Schaefer
Fri, 30 Oct 1992 21:07
DOT_LOCK weird bug found, fix enclosed
Author: Barton E. Schaefer
Date: Fri, 30 Oct 1992 21:07
Date: Fri, 30 Oct 1992 21:07
111 lines
3177 bytes
3177 bytes
The strange problem people were having that manifested as mush
seeming to read part of its folder as input resulted from calling
close() on something that was not a file descriptor. This only
happens when DOT_LOCK is defined; patch is appended.
This patch is a diff against 7.2.5 and includes previously posted changes
to lock.c and xcreat.c. The "fixed" subdirectory in mush-7.2.5.tar.Z in
cse.ogi.edu's ftp area has these changes now.
*** lock.c Fri Oct 30 11:55:34 1992
--- fixed/lock.c Fri Oct 30 12:55:37 1992
***************
*** 76,81 ****
--- 76,83 ----
if (!myname)
myname = argv[0];
+ else
+ myname++;
if (strcmp(myname, DOLOCK_NAME) != 0 || argc != 3)
exit(-1);
***************
*** 154,160 ****
(void) sprintf(buf, "%s.lock", filename);
#endif /* M_XENIX */
on_intr();
! while ((lockfd = xcreat(buf, 0444)) == -1) {
if (errno != EEXIST) {
error("unable to lock %s", filename);
break;
--- 156,162 ----
(void) sprintf(buf, "%s.lock", filename);
#endif /* M_XENIX */
on_intr();
! while ((lockfd = xcreat(buf, 0444)) < 0) {
if (errno != EEXIST) {
error("unable to lock %s", filename);
break;
***************
*** 170,179 ****
}
}
off_intr();
! if (lockfd != -1) {
if (cnt)
print("done.\n");
- (void) close(lockfd);
}
#ifdef LOCK_PROG
if (lockfd < 0)
--- 172,180 ----
}
}
off_intr();
! if (lockfd >= 0) {
if (cnt)
print("done.\n");
}
#ifdef LOCK_PROG
if (lockfd < 0)
***************
*** 185,191 ****
#else
setgid(getgid());
#endif /* BSD */
! return lockfd == -1? -1 : 0;
#endif /* LOCK_PROG */
}
--- 186,192 ----
#else
setgid(getgid());
#endif /* BSD */
! return lockfd < 0? -1 : 0;
#endif /* LOCK_PROG */
}
*** xcreat.c Fri Oct 30 11:56:16 1992
--- fixed/xcreat.c Fri Oct 30 12:02:09 1992
***************
*** 158,164 ****
q = rindex(name, '/');
if (q)
! i = q - name;
else {
i = 0; /* Creating in the current directory */
}
--- 158,164 ----
q = rindex(name, '/');
if (q)
! i = (q - name) + 1;
else {
i = 0; /* Creating in the current directory */
}
***************
*** 165,171 ****
p = strncpy(buf, name, i);
if (unique(p, p + i, mode))
j = myrename(p, name); /* try and rename it, fails if nonexclusive */
- free(p);
return j;
}
--- 165,170 ----
--
Bart Schaefer schaefer@z-code.com
Z-Code Software Corporation schaefer@cse.ogi.edu
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads