+#ifdef O_NONBLOCK
+ int nonblocking = 0;
+
+ if (self->nonblocking_open) {
+ nonblocking = O_NONBLOCK;
+ }
+#endif
+
+#ifdef O_NONBLOCK
+ fd = robust_open(device_filename, O_RDWR | nonblocking, 0);
+ save_errno = errno;
+ if (fd < 0 && nonblocking && (save_errno == EWOULDBLOCK || save_errno == EINVAL)) {
+ /* Maybe we don't support O_NONBLOCK for tape devices. */
+ fd = robust_open(device_filename, O_RDWR, 0);
+ save_errno = errno;
+ }
+#else
+ fd = robust_open(device_filename, O_RDWR, 0);