]> mj.ucw.cz Git - libucw.git/blobdiff - ucw/fb-temp.c
Fastbuf: Rewritten bprintf()
[libucw.git] / ucw / fb-temp.c
index f3c574b6bb047d57851e26747dc2dac11722bd85..896870ea11e133033789c59c51096f2eca2b553a 100644 (file)
@@ -8,8 +8,8 @@
  *     of the GNU Lesser General Public License.
  */
 
-#include "ucw/lib.h"
-#include "ucw/fastbuf.h"
+#include <ucw/lib.h>
+#include <ucw/fastbuf.h>
 
 #include <stdio.h>
 #include <fcntl.h>
@@ -35,13 +35,13 @@ void bfix_tmp_file(struct fastbuf *fb, const char *name)
   int was_temp = bconfig(fb, BCONFIG_IS_TEMP_FILE, 0);
   ASSERT(was_temp == 1);
   if (rename(fb->name, name))
-    die("Cannot rename %s to %s: %m", fb->name, name);
+    bthrow(fb, "tmp", "Cannot rename %s to %s: %m", fb->name, name);
   bclose(fb);
 }
 
 #ifdef TEST
 
-#include "ucw/getopt.h"
+#include <ucw/getopt.h>
 
 int main(int argc, char **argv)
 {
@@ -50,6 +50,7 @@ int main(int argc, char **argv)
     die("Hey, whaddya want?");
 
   struct fastbuf *f = bopen_tmp(65536);
+  ASSERT(f && f->name);
   bputsn(f, "Hello, world!");
   bclose(f);
   return 0;