diff options
author | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-02-20 12:08:33 +0800 |
---|---|---|
committer | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-02-20 12:08:33 +0800 |
commit | d1bf6043e30457e19cade2d089e1a33642b27f57 (patch) | |
tree | de1a03ce751c1e1cba837ab736dd34e7801380ba | |
parent | c1dfc037b337a648ae01dd004523703ca5f0b5c2 (diff) | |
download | pttbbs-d1bf6043e30457e19cade2d089e1a33642b27f57.tar pttbbs-d1bf6043e30457e19cade2d089e1a33642b27f57.tar.gz pttbbs-d1bf6043e30457e19cade2d089e1a33642b27f57.tar.bz2 pttbbs-d1bf6043e30457e19cade2d089e1a33642b27f57.tar.lz pttbbs-d1bf6043e30457e19cade2d089e1a33642b27f57.tar.xz pttbbs-d1bf6043e30457e19cade2d089e1a33642b27f57.tar.zst pttbbs-d1bf6043e30457e19cade2d089e1a33642b27f57.zip |
open 0600
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1550 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | mbbsd/vote.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/mbbsd/vote.c b/mbbsd/vote.c index 263f8989..8700c2ab 100644 --- a/mbbsd/vote.c +++ b/mbbsd/vote.c @@ -27,17 +27,19 @@ static void convert_to_newversion(FILE *fp, char *file, char *ballots) { char buf[256], buf2[256]; + short blah; int count = -1, tmp, fd, fdw; FILE *fpw; if ((fd = open(ballots, O_RDONLY)) != -1) { sprintf(buf, "%s.new", ballots); - fdw = open(buf, O_WRONLY | O_CREAT); + fdw = open(buf, O_WRONLY | O_CREAT, 0600); flock(fd, LOCK_EX); /* Thor: ¨¾¤î¦h¤H¦P®Éºâ */ while (read(fd, &buf2[0], 1) == 1) { - if (buf2[0] >= 'A') - buf2[0] -= 'A'; - write(fdw, &buf2[0], 1); + blah = buf2[0]; + if (blah >= 'A') + blah -= 'A'; + write(fdw, &blah, sizeof(short)); } flock(fd, LOCK_UN); close(fd); |