Restored error code reading to cenforce(). #87

Merged
merged 1 commit into from Jun 10, 2011

Conversation

Projects
None yet
4 participants
@klickverbot
Member

klickverbot commented Jun 8, 2011

The getErrno call was removed completely in commit cf02c92 by Shin, without any further comment instead of just calling GetLastError on Windows.

With this commit, the example from issue 4188 cited in cf02c92 still results in a sensible error message: »IDontExist.txt: The system cannot find the file specified.«

Restored error code reading to cenforce().
The getErrno() was removed completely in commit cf02c92 by Shin without any further comment instead of just calling GetLastError on Windows.
@jmdavis

This comment has been minimized.

Show comment
Hide comment
@jmdavis

jmdavis Jun 9, 2011

Member

Looks fine to me.

Member

jmdavis commented Jun 9, 2011

Looks fine to me.

@simendsjo

This comment has been minimized.

Show comment
Hide comment
@simendsjo

simendsjo Jun 9, 2011

The errno handling is a bit ugly. Cannot druntime add some convenience methods to avoid the versions?

uint getErrno() {
version(Windows) return GetLastError();
version(Posix) return .getErrno();
}

string getErrnoString(uint errno) {
version(Windows) return sysErrorString(errno);
version(Posix) return to!string(strerror(errno));
}

The errno handling is a bit ugly. Cannot druntime add some convenience methods to avoid the versions?

uint getErrno() {
version(Windows) return GetLastError();
version(Posix) return .getErrno();
}

string getErrnoString(uint errno) {
version(Windows) return sysErrorString(errno);
version(Posix) return to!string(strerror(errno));
}

This comment has been minimized.

Show comment
Hide comment
@andralex

andralex Jun 9, 2011

Trouble is Windows also has errno, and a cursory google search for <> does not reveal a simple relationship between the two.

Trouble is Windows also has errno, and a cursory google search for <> does not reveal a simple relationship between the two.

This comment has been minimized.

Show comment
Hide comment
@klickverbot

klickverbot Jun 9, 2011

Owner

Afaik, the error code for most WinAPI functions is available via GetLastError(). But it's not a global replacement/equivalent to the errno on Posix systems, e.g. for WinSock, you have to use WSAGetLastError() instead. Also, I think GetLastErrror() is not documented to work for the C standard library functions, although I don't think I remember a case where it didn't.

Owner

klickverbot replied Jun 9, 2011

Afaik, the error code for most WinAPI functions is available via GetLastError(). But it's not a global replacement/equivalent to the errno on Posix systems, e.g. for WinSock, you have to use WSAGetLastError() instead. Also, I think GetLastErrror() is not documented to work for the C standard library functions, although I don't think I remember a case where it didn't.

@andralex

This comment has been minimized.

Show comment
Hide comment
@andralex

andralex Jun 10, 2011

Member

I'm a gonna pull this.

Member

andralex commented Jun 10, 2011

I'm a gonna pull this.

andralex added a commit that referenced this pull request Jun 10, 2011

Merge pull request #87 from klickverbot/cenforce-errno
Restored error code reading to cenforce().

@andralex andralex merged commit 55493bc into dlang:master Jun 10, 2011

kuettler pushed a commit to kuettler/phobos that referenced this pull request Feb 6, 2018

Merge pull request #87 from MartinNowak/installDir
use INSTALL_DIR like all the other DPL projects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment