- int filedes = attropen(path, attrpath, oflag, mode);
- if (filedes == -1) {
- if (errno != ENOENT)
- LOG(log_error, logtype_default, "attropen(\"%s\", ea:'%s'): %s",
- path, attrpath, strerror(errno));
- errno = ENOATTR;
+ EC_INIT;
+ int filedes = -1, eafd = -1;
+
+ if ((filedes = open(path, O_RDONLY | (oflag & O_NOFOLLOW), mode)) == -1) {
+ switch (errno) {
+ case ENOENT:
+ case EEXIST:
+ case OPEN_NOFOLLOW_ERRNO:
+ EC_FAIL;
+ default:
+ LOG(log_debug, logtype_default, "open(\"%s\"): %s", fullpathname(path), strerror(errno));
+ EC_FAIL;
+ }