-
Notifications
You must be signed in to change notification settings - Fork 3
Implementation for sys/stat.h #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devs/expertise/native-windows
Are you sure you want to change the base?
Implementation for sys/stat.h #59
Conversation
Coquinho
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your implementation should be an evil_ not an unposix/, so please move stah{h,c} to evil/evil_stat.{h,c}.
|
how exactly can we test it? |
5f9f866 to
62d2389
Compare
62d2389 to
4235c4f
Compare
4235c4f to
598bc10
Compare
joaoantoniocardoso
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am changing my approval to be clear that some work still needs to be done.
187ed15 to
700df59
Compare
joaoantoniocardoso
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there, just some minor changes for me.
Is there some way to test it?
a1ad61f to
c506a45
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code seems fine to me, how can I test this?
Coquinho
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can I test this?
And another thing, should these new things be inside some #ifndef CYGWIN(don't remember if it's exactly like that) as this isn't needed when building with it, but only when building windows natively?
joaoantoniocardoso
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#169 changed EAPI to EVIL_API
Update stat.h
Update stat.c
Update stat.h
Update stat.c
Update stat.h
including Windows.h at WIN_LEAN_AND_MEAN.
Co-authored-by: Lucas <Coquinho@users.noreply.github.com>
moving stat. {h, c) for evil / evil stat. {h, c}
deleting items, which were copied to another directory
…c' in lib/evil/meson.build
584be66 to
6f33c48
Compare
…pertisesolutions/efl into devs/expertise-ricardo/sys/stat.h
| { | ||
| int r_fstatat; | ||
|
|
||
| if (pathname[1] == ':' && pathname[2] == '\\' || pathname[2] == '/' ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You must check the buffer size before accessing it.
| do | ||
| { | ||
| pathbuf_size += MAX_PATH; | ||
| pathbuf = realloc(pathbuf, pathbuf_size * sizeof(char)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The memory allocated here is never freed.
| } | ||
|
|
||
| size_str = strlen(pathbuf) + strlen(pathname); | ||
| char *path_complete = malloc(sizeof(char) * size_str + 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The memory allocated here is never freed.
| size_str = strlen(pathbuf) + strlen(pathname); | ||
| char *path_complete = malloc(sizeof(char) * size_str + 1); | ||
| strcpy(path_complete, pathbuf); | ||
| strcat(path_complete, pathname); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if pathbuf doesn't end with a path separator?
| if (flags == AT_SYMLINK_NOFOLLOW) | ||
| r_fstatat = stat(pathname, statbuf); | ||
| else | ||
| r_fstatat = stat(pathname, statbuf); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the if both calls are exactly the same?
| pathbuf[size_str + 1] = 0; | ||
| break; | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about using _splitpath instead of a manual for loop?
| else | ||
| { | ||
| r_fstatat = stat(path_complete, statbuf); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the if?
Coquinho
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey guys, what do you think about breaking this in 2 PR? We could have one with the functions, which seems to still have some loose ends, and we can approve the definitions, as it seems there is no discussion there.
This PR aims to implement the function:
for Windows;
and declare the functions in stat.h:
(using the header: <corecrt_io.h> and <errno.h>)