- if (pathconf(sys_node, _PC_NAME_MAX) == -1) {
- /* Limit not defined, or error */
- ERROR("%s: pathconf failed", g_plugin_name);
- closedir(dir);
- return -1;
+ errno = 0;
+ if ((lim = pathconf(sys_node, _PC_NAME_MAX)) == -1) {
+ /* Limit not defined if errno == 0, otherwise error */
+ if (errno != 0) {
+ ERROR("%s: pathconf failed", g_plugin_name);
+ closedir(dir);
+ return -1;
+ } else {
+ lim = PATH_MAX;
+ }