]> mj.ucw.cz Git - libucw.git/blobdiff - lib/fb-file.c
libucw: removed utf8_check routine... it did not check correct UTF-8
[libucw.git] / lib / fb-file.c
index c45432775ca2ba2349a05f4a2a7ffa4143e84cfd..04f2f4cf444442141fcfb3b4e74d5e852a9f1a99 100644 (file)
@@ -11,6 +11,7 @@
 #include "lib/fastbuf.h"
 #include "lib/lfs.h"
 
+#include <stdio.h>
 #include <string.h>
 #include <fcntl.h>
 #include <unistd.h>
@@ -56,9 +57,6 @@ bfd_spout(struct fastbuf *f)
 static int
 bfd_seek(struct fastbuf *f, sh_off_t pos, int whence)
 {
-  if (whence == SEEK_SET && pos == f->pos)
-    return 1;
-
   sh_off_t l = sh_seek(FB_FILE(f)->fd, pos, whence);
   if (l < 0)
     return 0;
@@ -73,7 +71,7 @@ bfd_close(struct fastbuf *f)
     {
     case 1:
       if (unlink(f->name) < 0)
-       log(L_ERROR, "unlink(%s): %m", f->name);
+       msg(L_ERROR, "unlink(%s): %m", f->name);
     case 0:
       close(FB_FILE(f)->fd);
     }
@@ -94,7 +92,7 @@ bfd_config(struct fastbuf *f, uns item, int value)
 }
 
 static struct fastbuf *
-bfdopen_internal(int fd, uns buflen, byte *name)
+bfdopen_internal(int fd, uns buflen, const char *name)
 {
   int namelen = strlen(name) + 1;
   struct fb_file *F = xmalloc(sizeof(struct fb_file) + buflen + namelen);
@@ -117,7 +115,7 @@ bfdopen_internal(int fd, uns buflen, byte *name)
 }
 
 struct fastbuf *
-bopen_try(byte *name, uns mode, uns buflen)
+bopen_try(const char *name, uns mode, uns buflen)
 {
   int fd = sh_open(name, mode, 0666);
   if (fd < 0)
@@ -129,7 +127,7 @@ bopen_try(byte *name, uns mode, uns buflen)
 }
 
 struct fastbuf *
-bopen(byte *name, uns mode, uns buflen)
+bopen(const char *name, uns mode, uns buflen)
 {
   if (!buflen)
     return bopen_mm(name, mode);
@@ -162,7 +160,7 @@ bfilesync(struct fastbuf *b)
 {
   bflush(b);
   if (fsync(FB_FILE(b)->fd) < 0)
-    log(L_ERROR, "fsync(%s) failed: %m", b->name);
+    msg(L_ERROR, "fsync(%s) failed: %m", b->name);
 }
 
 #ifdef TEST