X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=inline;f=ucw%2Ffb-temp.c;h=3ffa08c3fec99644ba1efac9cc5283e17093e99d;hb=f1155256f7a168f5e2c0097cb4e7197b79c4f041;hp=f3c574b6bb047d57851e26747dc2dac11722bd85;hpb=cf90f199ff58a92dea4e52bbac0c2e91b37b58dc;p=libucw.git diff --git a/ucw/fb-temp.c b/ucw/fb-temp.c index f3c574b6..3ffa08c3 100644 --- a/ucw/fb-temp.c +++ b/ucw/fb-temp.c @@ -8,8 +8,8 @@ * of the GNU Lesser General Public License. */ -#include "ucw/lib.h" -#include "ucw/fastbuf.h" +#include +#include #include #include @@ -25,7 +25,7 @@ bopen_tmp_file(struct fb_params *params) } struct fastbuf * -bopen_tmp(uns buflen) +bopen_tmp(uint buflen) { return bopen_tmp_file(&(struct fb_params){ .type = FB_STD, .buffer_size = buflen }); } @@ -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 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;