struct cleanup *back_to;
int ix;
char *dir;
+ /* The errno set for the last name we tried to open (and
+ failed). */
+ int last_errno = 0;
/* The open syscall MODE parameter is not specified. */
gdb_assert ((mode & O_CREAT) == 0);
filename = NULL;
fd = -1;
}
+ last_errno = errno;
if (!(opts & OPF_SEARCH_IN_PATH))
for (i = 0; string[i]; i++)
alloclen = strlen (path) + strlen (string) + 2;
filename = (char *) alloca (alloclen);
fd = -1;
+ last_errno = ENOENT;
dir_vec = dirnames_to_char_ptr_vec (path);
back_to = make_cleanup_free_char_ptr_vec (dir_vec);
fd = gdb_open_cloexec (filename, mode, 0);
if (fd >= 0)
break;
+ last_errno = errno;
}
}
*filename_opened = gdb_abspath (filename);
}
+ errno = last_errno;
return fd;
}