commit - d7cada912ae751364577affaf215279bb0277122
commit + 3f054d11e48eaf4b4bace38f44c39d7dad538320
blob - 2478cabe77032e16271ce9c08dd85232ecfa5c47
blob + cca1a89db5ec65a5f9ca940b9288706706579d19
--- FICS/adminproc.c
+++ FICS/adminproc.c
FILE *new_fp, *old_fp;
char junk[MAX_LINE_SIZE] = { '\0' };
char tmp_file[MAX_FILENAME_SIZE] = { '\0' };
+ int fd;
msnprintf(tmp_file, sizeof tmp_file, "%s/.tmp.idx", news_dir);
- if ((new_fp = fopen(tmp_file, "w")) == NULL)
+ fd = open(tmp_file, O_WRONLY|O_CREAT, S_IWUSR|S_IRUSR);
+
+ if (fd < 0)
return 0;
+ else if ((new_fp = fdopen(fd, "w")) == NULL) {
+ close(fd);
+ return 0;
+ }
+
fprintf(new_fp, "%s", new_item);
if ((old_fp = fopen(filename, "r")) == NULL)