Просмотр исходного кода

* Fix possible situation where an error while saving userfile is not reported (fixes #287)


svn: 3681
Bryan Drewery 18 лет назад
Родитель
Сommit
beb5ec6604
2 измененных файлов с 7 добавлено и 0 удалено
  1. 1 0
      doc/UPDATES
  2. 6 0
      src/userrec.c

+ 1 - 0
doc/UPDATES

@@ -11,6 +11,7 @@
 * Bots now check their own hostmask before opping or requesting assistance to join a channel
 * Fix bans not being removed from channels when removed from bot. (fixes #352)
 * Dont show portmin/portmax/pscloak/autouname in binary config unless they are set
+* Fix possible situation where an error while saving userfile is not reported (fixes #287)
 
 1.2.14 - http://wraith.botpack.net/milestone/1.2.14
 * Fix another bug in shell functions. (fixes #321)

+ 6 - 0
src/userrec.c

@@ -487,6 +487,12 @@ int write_userfile(int idx)
   channels_writeuserfile(old);
 
   f = fopen(new_userfile, "a");
+  if (f == NULL) {
+    putlog(LOG_MISC, "*", "ERROR writing user file.");
+    free(new_userfile);
+    return 2;
+  }
+
   putlog(LOG_DEBUG, "@", "Writing user entries.");
   for (struct userrec *u = userlist; u && ok; u = u->next)
     ok = write_user(u, f, -1);