ci = g_tree_lookup (cache_tree, file);
if (ci == NULL) /* {{{ */
{
+ struct stat statbuf;
+
+ memset (&statbuf, 0, sizeof (statbuf));
+ status = stat (file, &statbuf);
+ if (status != 0)
+ {
+ pthread_mutex_unlock (&cache_lock);
+ RRDD_LOG (LOG_ERR, "handle_request_update: stat (%s) failed.", file);
+
+ status = errno;
+ if (status == ENOENT)
+ snprintf (answer, sizeof (answer), "-1 No such file: %s", file);
+ else
+ snprintf (answer, sizeof (answer), "-1 stat failed with error %i.\n",
+ status);
+ RRDD_UPDATE_SEND;
+ return (0);
+ }
+ if (!S_ISREG (statbuf.st_mode))
+ {
+ pthread_mutex_unlock (&cache_lock);
+
+ snprintf (answer, sizeof (answer), "-1 Not a regular file: %s", file);
+ RRDD_UPDATE_SEND;
+ return (0);
+ }
+
ci = (cache_item_t *) malloc (sizeof (cache_item_t));
if (ci == NULL)
{