Print this page
6017 savecore's messages about read errors are useless


 249 }
 250 
 251 /*
 252  * System call / libc wrappers that exit on error.
 253  */
 254 static int
 255 Open(const char *name, int oflags, mode_t mode)
 256 {
 257         int fd;
 258 
 259         if ((fd = open64(name, oflags, mode)) == -1)
 260                 logprint(SC_SL_ERR | SC_EXIT_ERR, "open(\"%s\"): %s",
 261                     name, strerror(errno));
 262         return (fd);
 263 }
 264 
 265 static void
 266 Fread(void *buf, size_t size, FILE *f)
 267 {
 268         if (fread(buf, size, 1, f) != 1)
 269                 logprint(SC_SL_ERR | SC_EXIT_ERR, "fread: ferror %d feof %d",
 270                     ferror(f), feof(f));
 271 }
 272 
 273 static void
 274 Fwrite(void *buf, size_t size, FILE *f)
 275 {
 276         if (fwrite(buf, size, 1, f) != 1)
 277                 logprint(SC_SL_ERR | SC_EXIT_ERR, "fwrite: %s",
 278                     strerror(errno));
 279 }
 280 
 281 static void
 282 Fseek(offset_t off, FILE *f)
 283 {
 284         if (fseeko64(f, off, SEEK_SET) != 0)
 285                 logprint(SC_SL_ERR | SC_EXIT_ERR, "fseeko64: %s",
 286                     strerror(errno));
 287 }
 288 
 289 typedef struct stat64 Stat_t;
 290 




 249 }
 250 
 251 /*
 252  * System call / libc wrappers that exit on error.
 253  */
 254 static int
 255 Open(const char *name, int oflags, mode_t mode)
 256 {
 257         int fd;
 258 
 259         if ((fd = open64(name, oflags, mode)) == -1)
 260                 logprint(SC_SL_ERR | SC_EXIT_ERR, "open(\"%s\"): %s",
 261                     name, strerror(errno));
 262         return (fd);
 263 }
 264 
 265 static void
 266 Fread(void *buf, size_t size, FILE *f)
 267 {
 268         if (fread(buf, size, 1, f) != 1)
 269                 logprint(SC_SL_ERR | SC_EXIT_ERR, "fread: %s",
 270                     strerror(errno));
 271 }
 272 
 273 static void
 274 Fwrite(void *buf, size_t size, FILE *f)
 275 {
 276         if (fwrite(buf, size, 1, f) != 1)
 277                 logprint(SC_SL_ERR | SC_EXIT_ERR, "fwrite: %s",
 278                     strerror(errno));
 279 }
 280 
 281 static void
 282 Fseek(offset_t off, FILE *f)
 283 {
 284         if (fseeko64(f, off, SEEK_SET) != 0)
 285                 logprint(SC_SL_ERR | SC_EXIT_ERR, "fseeko64: %s",
 286                     strerror(errno));
 287 }
 288 
 289 typedef struct stat64 Stat_t;
 290