chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[PATCH] support log-priority levels in udev.conf
[elogind.git]
/
klibc
/
klibc
/
fopen.c
diff --git
a/klibc/klibc/fopen.c
b/klibc/klibc/fopen.c
index 5c84184809af4118a9f9ed9310aa04d8b2c05c67..ee62c68bd75200a3ac62607a4bba4b6957eaa5af 100644
(file)
--- a/
klibc/klibc/fopen.c
+++ b/
klibc/klibc/fopen.c
@@
-13,10
+13,9
@@
FILE *fopen(const char *file, const char *mode)
{
int flags = O_RDONLY;
int plus = 0;
{
int flags = O_RDONLY;
int plus = 0;
- int fd;
while ( *mode ) {
while ( *mode ) {
- switch ( *mode ) {
+ switch ( *mode
++
) {
case 'r':
flags = O_RDONLY;
break;
case 'r':
flags = O_RDONLY;
break;
@@
-30,17
+29,12
@@
FILE *fopen(const char *file, const char *mode)
plus = 1;
break;
}
plus = 1;
break;
}
- mode++;
}
if ( plus ) {
flags = (flags & ~(O_RDONLY|O_WRONLY)) | O_RDWR;
}
}
if ( plus ) {
flags = (flags & ~(O_RDONLY|O_WRONLY)) | O_RDWR;
}
- fd = open(file, flags, 0666);
-
- if ( fd < 0 )
- return NULL;
- else
- return fdopen(fd, mode);
+ /* Note: __create_file(-1) == NULL, so this is safe */
+ return __create_file(open(file, flags, 0666));
}
}