Lines Matching refs:mbfd
740 int mbfd = -1, nr, nw = 0, off;
813 mbfd = open(path, O_APPEND|O_CREAT|O_EXCL|O_WRONLY,
815 if (mbfd != -1)
816 (void) fchmod(mbfd, 0660);
819 if (mbfd == -1) {
832 mbfd = open(path, O_APPEND|O_WRONLY, 0);
833 if (mbfd != -1 &&
834 (fstat(mbfd, &fsb) || fsb.st_nlink != 1 ||
844 if (mbfd == -1) {
855 curoff = lseek(mbfd, (off_t)0, SEEK_END);
868 if ((write(mbfd, unix_from_line, ulen)) != ulen) {
880 if ((nw = write(mbfd, buf + off, nr)) < 0)
898 if (write(mbfd, buf, len) != len) {
910 if ((nw = write(mbfd, buf + off, nr)) < 0) {
925 if (fsync(mbfd)) {
927 err2: if (mbfd >= 0)
928 (void)ftruncate(mbfd, curoff);
929 err1: (void)close(mbfd);
944 if (fstat(mbfd, &sb) < 0)
950 if (close(mbfd))
953 mbfd = open(path, O_WRONLY, 0);
954 if (mbfd < 0 ||
956 || flock(mbfd, LOCK_EX) < 0 ||
957 fstat(mbfd, &sb) < 0 ||
966 if (mbfd >= 0)
968 (void) close(mbfd);
969 mbfd = -1;