fcntl: open should use a va_list

The current implementation of open requires the user to pass all three
args to the function. It should use a va_list and allow a user to
provide only the filename and flags.
This commit is contained in:
Dan Robertson
2018-03-09 02:24:25 +00:00
parent 284cc4eece
commit e306e3f855
4 changed files with 18 additions and 4 deletions
+13
View File
@@ -0,0 +1,13 @@
#ifndef _BITS_FCNTL_H
#define _BITS_FCNTL_H
int open(const char* filename, int flags, ...) {
mode_t mode = 0;
va_list ap;
va_start(ap, flags);
mode = va_arg(ap, mode_t);
va_end(ap);
return sys_open(filename, flags, mode);
}
#endif