mirror of
https://gitlab.com/bztsrc/posix-uefi.git
synced 2025-01-01 03:25:52 +01:00
Allow more specific errno with remove
This commit is contained in:
parent
5a71f6ae11
commit
3cdef6a762
3 changed files with 5 additions and 1 deletions
|
@ -191,6 +191,7 @@ A `name` környezeti változó beállítása `len` hosszú `data` értékkel. Si
|
||||||
|
|
||||||
| Funkció | Leírás |
|
| Funkció | Leírás |
|
||||||
|---------------|----------------------------------------------------------------------------|
|
|---------------|----------------------------------------------------------------------------|
|
||||||
|
| remove | megszokott, de széles karakterű sztringet is elfogadhat |
|
||||||
| fopen | megszokott, de széles karakterű sztringet is elfogadhat, mode esetén is |
|
| fopen | megszokott, de széles karakterű sztringet is elfogadhat, mode esetén is |
|
||||||
| fclose | megszokott |
|
| fclose | megszokott |
|
||||||
| fflush | megszokott |
|
| fflush | megszokott |
|
||||||
|
|
|
@ -187,6 +187,7 @@ Sets an environment variable by `name` with `data` of length `len`. On success r
|
||||||
|
|
||||||
| Function | Description |
|
| Function | Description |
|
||||||
|---------------|----------------------------------------------------------------------------|
|
|---------------|----------------------------------------------------------------------------|
|
||||||
|
| remove | as usual, but might accept wide char strings |
|
||||||
| fopen | as usual, but might accept wide char strings, also for mode |
|
| fopen | as usual, but might accept wide char strings, also for mode |
|
||||||
| fclose | as usual |
|
| fclose | as usual |
|
||||||
| fflush | as usual |
|
| fflush | as usual |
|
||||||
|
|
|
@ -155,6 +155,8 @@ int __remove (const char_t *__filename, int isdir)
|
||||||
uintn_t fsiz = (uintn_t)sizeof(efi_file_info_t), i;
|
uintn_t fsiz = (uintn_t)sizeof(efi_file_info_t), i;
|
||||||
/* little hack to support read and write mode for Delete() without create mode */
|
/* little hack to support read and write mode for Delete() without create mode */
|
||||||
FILE *f = fopen(__filename, CL("@"));
|
FILE *f = fopen(__filename, CL("@"));
|
||||||
|
if(errno)
|
||||||
|
return 1;
|
||||||
if(!f || f == stdin || f == stdout || f == stderr || (__ser && f == (FILE*)__ser)) {
|
if(!f || f == stdin || f == stdout || f == stderr || (__ser && f == (FILE*)__ser)) {
|
||||||
errno = EBADF;
|
errno = EBADF;
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -204,6 +206,7 @@ FILE *fopen (const char_t *__filename, const char_t *__modes)
|
||||||
#ifndef UEFI_NO_UTF8
|
#ifndef UEFI_NO_UTF8
|
||||||
wchar_t wcname[BUFSIZ];
|
wchar_t wcname[BUFSIZ];
|
||||||
#endif
|
#endif
|
||||||
|
errno = 0;
|
||||||
if(!__filename || !*__filename || !__modes || !*__modes) {
|
if(!__filename || !*__filename || !__modes || !*__modes) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -269,7 +272,6 @@ FILE *fopen (const char_t *__filename, const char_t *__modes)
|
||||||
errno = ENODEV;
|
errno = ENODEV;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
errno = 0;
|
|
||||||
ret = (FILE*)malloc(sizeof(FILE));
|
ret = (FILE*)malloc(sizeof(FILE));
|
||||||
if(!ret) return NULL;
|
if(!ret) return NULL;
|
||||||
/* normally write means read,write,create. But for remove (internal '@' mode), we need read,write without create */
|
/* normally write means read,write,create. But for remove (internal '@' mode), we need read,write without create */
|
||||||
|
|
Loading…
Reference in a new issue