Code Review
/
src
/
app-framework-main.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
don't change of directory anymore
[src/app-framework-main.git]
/
src
/
wgtpkg-xmlsec.c
diff --git
a/src/wgtpkg-xmlsec.c
b/src/wgtpkg-xmlsec.c
index
843ea2b
..
a403b77
100644
(file)
--- a/
src/wgtpkg-xmlsec.c
+++ b/
src/wgtpkg-xmlsec.c
@@
-21,6
+21,7
@@
#include <dirent.h>
#include <string.h>
#include <assert.h>
#include <dirent.h>
#include <string.h>
#include <assert.h>
+#include <fcntl.h>
#include <libxml/tree.h>
#include <xmlsec/xmlsec.h>
#include <libxml/tree.h>
#include <xmlsec/xmlsec.h>
@@
-53,6
+54,7
@@
static int file_match_cb(const char *uri)
static void *file_open_cb(const char *file)
{
struct filedesc *fdesc;
static void *file_open_cb(const char *file)
{
struct filedesc *fdesc;
+ int fd;
FILE *f;
fdesc = file_of_name(file);
FILE *f;
fdesc = file_of_name(file);
@@
-61,10
+63,13
@@
static void *file_open_cb(const char *file)
return NULL;
}
return NULL;
}
- f = fopen(file, "r");
- if (f == NULL)
+ fd = openat(workdirfd, file, O_RDONLY);
+ f = fd < 0 ? NULL : fdopen(fd, "r");
+ if (f == NULL) {
syslog(LOG_ERR, "can't open file %s for reading", file);
syslog(LOG_ERR, "can't open file %s for reading", file);
- else
+ if (fd >= 0)
+ close(fd);
+ } else
fdesc->flags |= flag_opened;
return f;
fdesc->flags |= flag_opened;
return f;