amagnasco / xwpe

Upload of an abandoned ncurses-based programming environment
http://www.identicalsoftware.com/xwpe/
GNU General Public License v2.0
29 stars 6 forks source link

adapt call to access to use F_OK, R_OK, W_OK, X_OK. #47

Closed gbonnema closed 7 years ago

gbonnema commented 7 years ago

The call to access was coded in absolutes like access(filename, 0) for F_OK and access(filename, 2) for W_OK (write access). I altered the constants to use the designated constants from unistd.h. The same definitions occur in fcntl.h (no differences). The include file unistd.h shows:

#define R_OK 4 /* Test for read permission. */ #define W_OK 2 /* Test for write permission. */ #define X_OK 1 /* Test for execute permission. */ #define F_OK 0 /* Test for existence. */

Using the defines makes reading the source code simpeler. The man page warns that it uses the real id in stead of the effective id. For future consideration.

P.S. Alessandro, I will just merge this with experimental. That way we have quick updates, but still traceability.

gbonnema commented 7 years ago

P.S. Alessandro, I love the way Travis triggers automatically: good job!!