Fix arguments passing to open system call wrapper
#include <stdarg.h>
int open(const char *path, int flags, ...) {
- int ret;
+ mode_t mode = 0;
+ if (flags & O_CREAT) {
va_list args;
va_start(args, flags);
- ret = openat(AT_FDCWD, path, flags, args);
+ mode = va_arg(args, mode_t);
va_end(args);
- return ret;
+ }
+ return openat(AT_FDCWD, path, flags, mode);
}
