static FD_t lzdFdopen(FD_t fd, const char * fmode) { int fdno; LZFILE *lzfile; if (fd == NULL || fmode == NULL) return NULL; fdno = fdFileno(fd); fdSetFdno(fd, -1); /* XXX skip the fdio close */ if (fdno < 0) return NULL; lzfile = lzdopen(fdno, fmode); if (lzfile == NULL) return NULL; fdPush(fd, xzdio, lzfile, fdno); return fdLink(fd); }
/*@-globuse@*/ static /*@null@*/ FD_t lzdFdopen(void * cookie, const char * fmode) /*@globals fileSystem, internalState @*/ /*@modifies fileSystem, internalState @*/ { FD_t fd = c2f(cookie); int fdno = fdFileno(fd); XZFILE *xzfile; assert(fmode != NULL); fdSetFdno(fd, -1); /* XXX skip the fdio close */ if (fdno < 0) return NULL; xzfile = lzdopen(fdno, fmode); if (xzfile == NULL) return NULL; fdPush(fd, lzdio, xzfile, fdno); return fdLink(fd, "lzdFdopen"); }