+#ifdef DEFER_INIT_CWD
+ if (!parent) {
+ const char *icwd;
+
+ if (!_sysio_init_cwd && !nd->nd_root)
+ abort();
+
+ /*
+ * Finally have to set the current working directory. We can
+ * not tolerate errors here or else risk leaving the process
+ * in a very unexpected location. We abort then unless all goes
+ * well.
+ */
+ icwd = _sysio_init_cwd;
+ _sysio_init_cwd = NULL;
+ parent = nd->nd_root;
+ if (!parent)
+ abort();
+ (void )_sysio_namei(nd->nd_root, icwd, 0, NULL, &parent);
+ if (_sysio_p_chdir(parent) != 0)
+ abort();
+ }
+#endif
+