我们站用smthbbs 2004/01/19(INSTALL里面的日期)。
昨天开始,突然发现telnet方式下无法直接发文,但是可以re文。 web下没有问题。
发文时输入标题,回车,再回车,就直接退出到版面文章列表了。
跟踪了一下,发现bbs.c里post_article() 里
aborted = vedit(filepath, true, &eff_size, NULL);
返回-1, 后面就退出了函数post_article() 。
一直跟下去,发现stuff.c里,
957 int safe_mmapfile_handle(int fd, int prot, int flag, void **ret_ptr, off_t * size)
958 {
959 struct stat st;
960
961 *ret_ptr = MAP_FAILED;
962 if (fd < 0)
963 return 0;
964 if (fstat(fd, &st) < 0) {
965 close(fd);
966 return 0;
967 }
968 if (!S_ISREG(st.st_mode)) {
969 close(fd);
970 return 0;
971 }
972 if (st.st_size < 0) {
973 close(fd);
974 return 0;
975 }
976 *ret_ptr = mmap(NULL, st.st_size, prot, flag, fd, 0);
977 if (*ret_ptr == MAP_FAILED) {
978 return 0;
979 }
980 /*
981 * signal(SIGSEGV,sigbus);
982 */
983 *size = st.st_size;
984 return 1;
985 }
在976行处返回-1,mmap() 失败了。 Re文的时候没有问题。mmap返回-1229479936。
以下是gdb的调试的一些信息,不知道有没有用:
Breakpoint 2, safe_mmapfile_handle (fd=3, prot=1, flag=1, ret_ptr=0xbfc80f0c, size=0xbfc80f08) at stuff.c:976
976 *ret_ptr = mmap(NULL, st.st_size, prot, flag, fd, 0);
(gdb) where
#0 safe_mmapfile_handle (fd=3, prot=1, flag=1, ret_ptr=0xbfc80f0c, size=0xbfc80f08) at stuff.c:976
#1 0x08091321 in insert_from_fp (fp=0x95c9d60, attach_length=0x0) at edit.c:669
#2 0x080914f3 in read_file (filename=0xbfc816b0 "boards/Announce/M.1135683249.m0", attach_length=0x0) at edit.c:732
#3 0x08094109 in raw_vedit (filename=0xbfc816b0 "boards/Announce/M.1135683249.m0", saveheader=1, headlines=0, eff_size=0xbfc813f0, pattachpos=0xbfc80fc8) at edit.c:2041
#4 0x0809438a in vedit (filename=0xbfc816b0 "boards/Announce/M.1135683249.m0", saveheader=1, eff_size=0xbfc813f0, pattachpos=0x0) at edit.c:2120
#5 0x08064040 in post_article (conf=0xbfc81b10, q_file=0x8107a1d "", re_file=0x0) at bbs.c:2409
#6 0x08062b10 in do_post (conf=0xbfc81b10, fileinfo=0x95c8898, extraarg=0x0) at bbs.c:1919
#7 0x080db7c5 in read_key ()
#8 0x080b572c in do_select_internal ()
#9 0x080b57b3 in list_select ()
#10 0x080b5ade in list_select_loop ()
#11 0x080dc8b6 in new_i_read ()
#12 0x0806b32d in Read () at bbs.c:5434
#13 0x080ad181 in fav_onselect ()
#14 0x080b5274 in do_select_internal ()
#15 0x080b591c in list_select ()
#16 0x080b5ade in list_select_loop ()
#17 0x080ae947 in choose_board ()
#18 0x080aeba4 in FavBoard ()
#19 0x08084a1a in domenu ()
#20 0x080bac2d in main_bbs ()
#21 0x080b4381 in bbs_main ()
#22 0x080b44c5 in bbs_standalone_main ()
#23 0x080b460b in main ()
(gdb) print st.st_size
$1 = 0
(gdb) print prot
$2 = 1
(gdb) print flag
$3 = 1
(gdb) print fd
$4 = 3
(gdb) print st
$5 = {st_dev = 5634, __pad1 = 0, st_ino = 1269020, st_mode = 33184, st_nlink = 1, st_uid = 501, st_gid = 501, st_rdev = 0, __pad2 = 0, st_size = 0, st_blksize = 4096, st_blocks = 0, st_atim = {
tv_sec = 1135683250, tv_nsec = 0}, st_mtim = {tv_sec = 1135683250, tv_nsec = 0}, st_ctim = {tv_sec = 1135683250, tv_nsec = 0}, __unused4 = 0, __unused5 = 0}
(gdb)
重新启动了系统,包括重启机器都没有解决问题。
请教高手!多谢各位了~
--
FROM 202.108.130.*