int fchmod(int fd, mode_t mode) { int saved_errno = errno; int result = __fchmod(fd, mode); if (result == 0 || errno != EBADF) { return result;
}
// fd could be an O_PATH file descriptor, and the kernel // may not directly support fchmod() on such a file descriptor. // Use /proc/self/fd instead to emulate this support. // https://sourceware.org/bugzilla/show_bug.cgi?id=14578 // // As of February 2015, there are no kernels which support fchmod // on an O_PATH file descriptor, and "man open" documents fchmod // on O_PATH file descriptors as returning EBADF. int fd_flag = fcntl(fd, F_GETFL); if (fd_flag == -1 || (fd_flag & O_PATH) == 0) {
errno = EBADF; return -1;
}
errno = saved_errno;
result = chmod(FdPath(fd).c_str(), mode); if (result == -1 && errno == ELOOP) { // Linux does not support changing the mode of a symlink. // For fchmodat(AT_SYMLINK_NOFOLLOW), POSIX requires a return // value of ENOTSUP. Assume that's true here too.
errno = ENOTSUP;
}
return result;
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.18 Sekunden
(vorverarbeitet am 2026-06-28)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.