summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-01-30 13:59:36 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-01-30 13:59:36 +0800
commitcd29a1da3cbeec80559309f8e16bba071137f2f8 (patch)
tree00f5c657e0d119515a5c46f0b56c4b169307d573 /mbbsd
parent25ab88da2f3b6244c861c859999f658fc4c2990e (diff)
downloadpttbbs-cd29a1da3cbeec80559309f8e16bba071137f2f8.tar
pttbbs-cd29a1da3cbeec80559309f8e16bba071137f2f8.tar.gz
pttbbs-cd29a1da3cbeec80559309f8e16bba071137f2f8.tar.bz2
pttbbs-cd29a1da3cbeec80559309f8e16bba071137f2f8.tar.lz
pttbbs-cd29a1da3cbeec80559309f8e16bba071137f2f8.tar.xz
pttbbs-cd29a1da3cbeec80559309f8e16bba071137f2f8.tar.zst
pttbbs-cd29a1da3cbeec80559309f8e16bba071137f2f8.zip
- board: enable changing to MyFavorite in HotBoards
- bugfix: snprintf() on UNIX takes directly sizeof(buf) and always append NUL. Warning: Windows port will not output NUL if truncated. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3883 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/aids.c3
-rw-r--r--mbbsd/bbslua.c4
-rw-r--r--mbbsd/board.c2
-rw-r--r--mbbsd/read.c3
4 files changed, 3 insertions, 9 deletions
diff --git a/mbbsd/aids.c b/mbbsd/aids.c
index 53bca85b..2b5baac7 100644
--- a/mbbsd/aids.c
+++ b/mbbsd/aids.c
@@ -79,8 +79,7 @@ char *aidu2fn(char *fn, aidu_t aidu)
if(fn == NULL)
return NULL;
- snprintf(fn, FNLEN - 1, "%c.%d.A.%03X", ((type == 0) ? 'M' : 'G'), (unsigned int)v1, (unsigned int)v2);
- fn[FNLEN - 1] = '\0';
+ snprintf(fn, FNLEN, "%c.%d.A.%03X", ((type == 0) ? 'M' : 'G'), (unsigned int)v1, (unsigned int)v2);
return fn;
}
diff --git a/mbbsd/bbslua.c b/mbbsd/bbslua.c
index 50eb69bc..ebe8e23c 100644
--- a/mbbsd/bbslua.c
+++ b/mbbsd/bbslua.c
@@ -744,7 +744,6 @@ bls_setfn(char *fn, size_t sz, const char *p)
case BLS_GLOBAL:
snprintf(fn, sz, "%s/" BLSCONF_PREFIX "U%08x",
BLSCONF_GPATH, blrt.storename);
- fn[sz-1] = 0;
return 1;
case BLS_USER:
@@ -754,7 +753,6 @@ bls_setfn(char *fn, size_t sz, const char *p)
snprintf(fn + strlen(fn),
sz - strlen(fn),
"/" BLSCONF_PREFIX "G%08x", blrt.storename);
- fn[sz-1] = 0;
return 1;
}
return 0;
@@ -1337,7 +1335,6 @@ bbslua_logo(lua_State *L)
snprintf(msg, sizeof(msg),
" ▲ 此程式使用新版的 BBS-Lua 規格 (%0.3f),您可能無法正常執行",
tocinterface);
- msg[sizeof(msg)-1] = 0;
fullmsg(msg);
fullmsg(" 若執行出現錯誤,建議您重新登入 BBS 後再重試");
fullmsg("");
@@ -1386,7 +1383,6 @@ bbslua_logo(lua_State *L)
snprintf(msg, sizeof(msg),
" ■ BBS-Lua %.03f (Build " __DATE__ " " __TIME__") ",
(double)BBSLUA_INTERFACE_VER);
- msg[sizeof(msg)-1] = 0;
fullmsg(msg);
// system break key prompt
diff --git a/mbbsd/board.c b/mbbsd/board.c
index 2a4b3dd5..a6704199 100644
--- a/mbbsd/board.c
+++ b/mbbsd/board.c
@@ -1609,7 +1609,7 @@ choose_board(int newflag)
// MyFav Functionality (Require PERM_BASIC)
///////////////////////////////////////////////////////
case 'y':
- if (HasFavEditPerm() && IN_FAVORITE()) {
+ if (HasFavEditPerm() && !(IN_CLASS())) {
if (get_current_fav() != NULL || !IS_LISTING_FAV()){
yank_flag ^= 1; /* FAV <=> BRD */
}
diff --git a/mbbsd/read.c b/mbbsd/read.c
index 52f010ee..66ea613f 100644
--- a/mbbsd/read.c
+++ b/mbbsd/read.c
@@ -1177,8 +1177,7 @@ get_records_and_bottom(char *direct, fileheader_t* headers,
if (n > 0) {
char directbottom[PATHLEN];
- snprintf(directbottom, sizeof(directbottom)-1, "%s.bottom", direct);
- directbottom[sizeof(directbottom)-1] = 0;
+ snprintf(directbottom, sizeof(directbottom), "%s.bottom", direct);
n = get_records(directbottom, headers+rv, sizeof(fileheader_t), 1, n);
if (n < 0) n = 0;
rv += n;