diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2009-05-19 13:51:37 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2009-05-19 13:51:37 +0000 |
commit | fbdebf465713844d23625ae09e0ae4995418328b (patch) | |
tree | 7af6455b1a462e3cba7eb1710604a7d2ea94be37 /gdb/source.c | |
parent | 5fd62852f643d6fa71d7a0225237c7874868b695 (diff) | |
download | gdb-fbdebf465713844d23625ae09e0ae4995418328b.zip gdb-fbdebf465713844d23625ae09e0ae4995418328b.tar.gz gdb-fbdebf465713844d23625ae09e0ae4995418328b.tar.bz2 |
gdb/
Remove the PROT parameter from openp.
* source.c (openp): Remove the parameter PROT. Assertion check MODE.
defs.h (openp): Update the prototype.
Update all the openp callers.
Diffstat (limited to 'gdb/source.c')
-rw-r--r-- | gdb/source.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/gdb/source.c b/gdb/source.c index 50f3510..e1bbb7f 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -658,7 +658,8 @@ is_regular_file (const char *name) } /* Open a file named STRING, searching path PATH (dir names sep by some char) - using mode MODE and protection bits PROT in the calls to open. + using mode MODE in the calls to open. You cannot use this function to + create files (O_CREAT). OPTS specifies the function behaviour in specific cases. @@ -685,8 +686,7 @@ is_regular_file (const char *name) >>>> eg executable, non-directory */ int openp (const char *path, int opts, const char *string, - int mode, int prot, - char **filename_opened) + int mode, char **filename_opened) { int fd; char *filename; @@ -695,6 +695,9 @@ openp (const char *path, int opts, const char *string, int len; int alloclen; + /* The open syscall MODE parameter is not specified. */ + gdb_assert ((mode & O_CREAT) == 0); + if (!path) path = "."; @@ -708,7 +711,7 @@ openp (const char *path, int opts, const char *string, { filename = alloca (strlen (string) + 1); strcpy (filename, string); - fd = open (filename, mode, prot); + fd = open (filename, mode); if (fd >= 0) goto done; } @@ -827,7 +830,7 @@ source_full_path_of (const char *filename, char **full_pathname) int fd; fd = openp (source_path, OPF_TRY_CWD_FIRST | OPF_SEARCH_IN_PATH, filename, - O_RDONLY, 0, full_pathname); + O_RDONLY, full_pathname); if (fd < 0) { *full_pathname = NULL; @@ -1017,13 +1020,13 @@ find_and_open_source (struct objfile *objfile, } } - result = openp (path, OPF_SEARCH_IN_PATH, filename, OPEN_MODE, 0, fullname); + result = openp (path, OPF_SEARCH_IN_PATH, filename, OPEN_MODE, fullname); if (result < 0) { /* Didn't work. Try using just the basename. */ p = lbasename (filename); if (p != filename) - result = openp (path, OPF_SEARCH_IN_PATH, p, OPEN_MODE, 0, fullname); + result = openp (path, OPF_SEARCH_IN_PATH, p, OPEN_MODE, fullname); } return result; |