Lines Matching refs:fd

265 	int			 fd;
386 static int set_fflags_platform(struct archive_write_disk *, int fd,
415 int oerrno, fd;
422 fd = __archive_mkstemp(a->tmpname);
423 if (fd == -1)
427 if (fchmod(fd, mode) == -1) {
429 close(fd);
433 return fd;
437 la_opendirat(int fd, const char *path) {
457 if (fd != AT_FDCWD) {
463 return (openat(fd, path, flags));
475 if (a->fd >= 0 && fstat(a->fd, &a->st) == 0) {
571 a->fd = -1;
786 if (a->fd < 0 || fchflags(a->fd, UF_COMPRESSED) != 0)
905 if (a->fd < 0) {
935 if (a->filesize == 0 || a->fd < 0) {
990 if (lseek(a->fd, a->offset, SEEK_SET) < 0) {
997 bytes_written = write(a->fd, buff, bytes_to_write);
1028 if (fchflags(a->fd, a->st.st_flags) != 0) {
1064 r = fsetxattr(a->fd, DECMPFS_XATTR_NAME, a->decmpfs_header_p,
1072 fremovexattr(a->fd, XATTR_RESOURCEFORK_NAME,
1121 ret = fsetxattr(a->fd, XATTR_RESOURCEFORK_NAME, buff, bytes,
1225 r = fgetxattr(a->fd, XATTR_RESOURCEFORK_NAME,
1252 bytes_written = write(a->fd, b, bytes_to_write);
1262 r = fremovexattr(a->fd, XATTR_RESOURCEFORK_NAME, 0);
1559 if (a->filesize == 0 || a->fd < 0) {
1678 if (a->fd < 0) {
1705 if (ftruncate(a->fd, a->filesize) == -1 &&
1724 if (lseek(a->fd, a->filesize - 1, SEEK_SET) < 0) {
1729 if (write(a->fd, &nul, 1) < 0) {
1856 r2 = archive_write_disk_set_acls(&a->archive, a->fd,
1864 /* If there's an fd, we can close it now. */
1865 if (a->fd >= 0) {
1866 close(a->fd);
1867 a->fd = -1;
2160 if ((a->fd = la_mktemp(a)) == -1) {
2317 a->fd = open(a->name, O_WRONLY | O_TRUNC |
2319 __archive_ensure_cloexec_flag(a->fd);
2320 if (a->fd < 0)
2373 a->fd = open(a->name,
2375 __archive_ensure_cloexec_flag(a->fd);
2376 r = (a->fd < 0);
2466 int fd, ret;
2477 fd = -1;
2493 fd = open(p->name, O_BINARY | O_NOFOLLOW | O_RDONLY
2504 if (fd == -1) {
2512 if (fd > 0 && (
2513 fstat(fd, &st) != 0 || !S_ISDIR(st.st_mode))) {
2524 set_times(a, fd, p->mode, p->name,
2532 if (fd >= 0)
2533 fchmod(fd, p->mode & 07777);
2543 archive_write_disk_set_acls(&a->archive, fd,
2546 set_fflags_platform(a, fd, p->name,
2556 if (fd >= 0)
2557 close(fd);
2750 int fd;
2838 fd = la_opendirat(chdir_fd, head);
2839 if (fd < 0)
2844 chdir_fd = fd;
2964 fd = la_opendirat(chdir_fd, head);
2965 if (fd < 0)
2970 chdir_fd = fd;
3013 * no chdir(), so just close the fd */
3401 /* If we have an fd, we can avoid a race. */
3402 if (a->fd >= 0 && fchown(a->fd, a->uid, a->gid) == 0) {
3435 set_time(int fd, int mode, const char *name,
3452 if (fd >= 0)
3453 return futimens(fd, ts);
3471 if (fd >= 0)
3472 return (futimes(fd, times));
3474 (void)fd; /* UNUSED */
3491 (void)fd; /* UNUSED */
3505 (void)fd; /* UNUSED */
3516 set_time_tru64(int fd, int mode, const char *name,
3534 return (fcntl(fd,F_SETTIMES,&tstamp));
3540 int fd, int mode, const char *name,
3557 set_time_tru64(fd, mode, name,
3578 r1 = set_time(fd, mode, name,
3585 r2 = set_time(fd, mode, name,
3631 return set_times(a, a->fd, a->mode, a->name,
3732 * an fd. Dirs get their perms set during the
3736 if (a->fd >= 0)
3737 r2 = fchmod(a->fd, mode);
3820 r = set_fflags_platform(a, a->fd,
3854 return (set_fflags_platform(a, a->fd, a->name, mode, 0,
3864 set_fflags_platform(struct archive_write_disk *a, int fd, const char *name,
3905 /* If platform has fchflags() and we were given an fd, use it. */
3906 if (fd >= 0 && fchflags(fd, a->st.st_flags) == 0)
3910 * If we can't use the fd to set the flags, we'll use the
3939 set_fflags_platform(struct archive_write_disk *a, int fd, const char *name,
3943 int myfd = fd;
3974 /* If we weren't given an fd, open it ourselves. */
4031 if (fd < 0)
4043 set_fflags_platform(struct archive_write_disk *a, int fd, const char *name,
4047 (void)fd; /* UNUSED */
4272 int fd;
4282 fd = mkstemp(tmp.s);
4284 if (fd < 0) {
4290 written = write(fd, metadata, metadata_size);
4291 close(fd);
4320 int fd = -1, ret = ARCHIVE_OK;
4347 fd = open(pathname, O_RDONLY | O_BINARY | O_CLOEXEC);
4348 __archive_ensure_cloexec_flag(fd);
4349 if (fd == -1) {
4355 if (read(fd, buff, 8) == -1) {
4358 close(fd);
4362 close(fd);
4432 if (a->fd >= 0) {
4434 e = fsetxattr(a->fd, name, value, size, 0);
4436 e = fsetxattr(a->fd, name, value, size, 0, 0);
4438 e = fsetea(a->fd, name, value, size, 0);
4523 if (a->fd >= 0) {
4542 e = extattr_set_fd(a->fd, namespace, name,
4644 archive_write_disk_set_acls(struct archive *a, int fd, const char *name,
4648 (void)fd; /* UNUSED */