Skip to content
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

[Possible enhancement] Redundant check in VirtualMemory.cpp #7997

Closed
sampletext32 opened this issue Apr 9, 2020 · 1 comment · Fixed by #8011
Closed

[Possible enhancement] Redundant check in VirtualMemory.cpp #7997

sampletext32 opened this issue Apr 9, 2020 · 1 comment · Fixed by #8011

Comments

@sampletext32
Copy link
Contributor

sampletext32 commented Apr 9, 2020

while ((m_file = ::shm_open("/rpcs3-mem1", O_RDWR | O_CREAT | O_EXCL, S_IWUSR | S_IRUSR)) == -1)
{
if (m_file == -1 && errno == EMFILE)
{
fmt::throw_exception("Too many open files. Raise the limit and try again.");
}

@elad335

Explanation

m_file is already checked for -1 in loop header. So check is redundant inside "if"

Suggestion

	if (errno == EMFILE) 
@elad335
Copy link
Contributor

elad335 commented Apr 9, 2020

It's a small change and seems correct, you can pull request it yourself as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants