예제 #1
0
파일: gp_unifs.c 프로젝트: hackqiang/gs
int gp_fpwrite(char *buf, uint count, int64_t offset, FILE *f)
{
#if defined(HAVE_PREAD_PWRITE) && HAVE_PREAD_PWRITE == 1
    return pwrite(fileno(f), buf, count, offset);
#else
    uint c;
    int64_t os, curroff = gp_ftell_64(f);
    if (curroff < 0) return curroff;
    
    os = gp_fseek_64(f, offset, 0);
    if (os < 0) return os;
    
    c = fwrite(buf, 1, count, f);
    if (c < 0) return c;
    
    os = gp_fseek_64(f, curroff, 0);
    if (os < 0) return os;
    
    return c;
#endif
}
예제 #2
0
static int
clist_fseek(clist_file_ptr cf, int64_t offset, int mode, const char *ignore_fname)
{
    return gp_fseek_64((FILE *) cf, offset, mode);
}