rem: while ((result = fcntl(fd, F_SETLKW, &lock)) < 0 || errno == EINTR)
add: while ((result = fcntl(fd, F_SETLKW, &lock)) < 0 && errno == EINTR)
context: write_encoding_file(String &filename, const String &encoding_name,		    StringAccum &contents, ErrorHandler *errh){    FILE *f;    int ok_retval = (access(filename.c_str(), R_OK) >= 0 ? 0 : 1);    if (no_create) {	errh->message((ok_retval ? "would create encoding file %s" : "would update encoding file %s"), filename.c_str());	return ok_retval;    } else if (verbose)	errh->message((ok_retval ? "creating encoding file %s" : "updating encoding file %s"), filename.c_str());        int fd = open(filename.c_str(), O_RDWR | O_CREAT, 0666);    if (fd < 0)	return errh->error("%s: %s", filename.c_str(), strerror(errno));    f = fdopen(fd, "r+");    // NB: also change update_autofont_map if you change this code#if defined(F_SETLKW) && defined(HAVE_FTRUNCATE)    {	struct flock lock;	lock.l_type = F_WRLCK;	lock.l_whence = SEEK_SET;	lock.l_start = 0;	lock.l_len = 0;	int result;	while ((result = fcntl(fd, F_SETLKW, &lock)) < 0 || errno == EINTR)	    /* try again */;	if (result < 0) {	    result = errno;	    fclose(f);	    return errh->error("locking %s: %s", filename.c_str(), strerror(result));	}    }#endif    // read old data from encoding file    StringAccum sa;    while (!feof(f))	if (char *x = sa.reserve(8192)) {	    int amt = fread(x, 1, 8192, f);	    sa.forward(amt);	} else {	    fclose(f);	    return errh->error("Out of memory!");	}    String old_encodings = sa.take_string();    bool created = (!old_encodings);    // append old encodings    int pos1 = old_encodings.find_left("\n%%");    while (pos1 < old_encodings.length()) {	int pos2 = old_encodings.find_left("\n%%", pos1 + 1);	if (pos2 < 0)	    pos2 = old_encodings.length();	if (old_encodings.substring(pos1 + 3, encoding_name.length()) == encoding_name) {	    // encoding already exists, don't change it	    fclose(f);	    if (verbose)		errh->message("%s unchanged", filename.c_str());	    return 0;	} else	    contents << old_encodings.substring(pos1, pos2 - pos1);	pos1 = pos2;    }        // rewind file#ifdef HAVE_FTRUNCATE    rewind(f);    ftruncate(fd, 0);#else    fclose(f);    f = fopen(filename.c_str(), "w");#endif    fwrite(contents.data(), 1, contents.length(), f);    fclose(f);    // inform about the new file if necessary    if (created)	update_odir(O_ENCODING, filename, errh);    return 0;}