--- dvbapi.c.orig	2005-01-16 03:10:46.000000000 +0100
+++ dvbapi.c	2005-01-16 03:16:57.000000000 +0100
@@ -1987,7 +1987,10 @@
               Quality = 255; //XXX is this 'best'???
          
            isyslog(LOG_INFO, "grabbing to %s (%s %d %d %d)", FileName, Jpeg ? "JPEG" : "PNM", Quality, vm.width, vm.height);
-           FILE *f = fopen(FileName, "wb");
+	   /* TODO: It might be better to strip FileName from directory
+	    * information and create the files in a specific location 
+	    * /
+           FILE *f = open(FileName, O_CREAT | O_EXCL | O_TRUNC | O_RDWR, 0600);
            if (f) {
               if (Jpeg) {
                  // write JPEG file:
@@ -2021,7 +2024,7 @@
                     result |= 1;
                     }
                  }
-              fclose(f);
+              close(f);
               }
            else {
               LOG_ERROR_STR(FileName);
