~ubuntu-branches/ubuntu/trusty/monit/trusty-proposed

« back to all changes in this revision

Viewing changes to src/validate.c

  • Committer: Package Import Robot
  • Author(s): Sergey B Kirpichev
  • Date: 2012-12-12 22:52:55 UTC
  • Revision ID: package-import@ubuntu.com-20121212225255-cf91fsgh5x8ylbd3
Tags: 1:5.5-4
* Fix (I think) FTBFS on ia64 due to installed automake
* Update patch 11: fix PATH_MAX issues for Hurd

Show diffs side-by-side

added added

removed removed

Lines of Context:
227
227
 */
228
228
int check_filesystem(Service_T s) {
229
229
        char *p;
 
230
#ifdef PATH_MAX
230
231
        char path_buf[PATH_MAX+1];
 
232
#else
 
233
        char *path_buf = NULL;
 
234
#endif
231
235
        Filesystem_T td;
232
236
        struct stat stat_buf;
233
237
 
241
245
                return FALSE;
242
246
        }
243
247
        if (S_ISLNK(stat_buf.st_mode)) {
244
 
                if (! realpath(s->path, path_buf)) {
 
248
                p = realpath(s->path, path_buf);
 
249
                if (! p) {
245
250
                        Event_post(s, Event_Nonexist, STATE_FAILED, s->action_NONEXIST, "filesystem symbolic link error -- %s", STRERROR);
246
251
                        return FALSE;
247
252
                }
262
267
                Event_post(s, Event_Data, STATE_FAILED, s->action_DATA, "unable to read filesystem %s state", p);
263
268
                return FALSE;
264
269
        }
 
270
#ifndef PATH_MAX
 
271
        free(path_buf);
 
272
#endif
265
273
        s->inf->priv.filesystem.inode_percent = s->inf->priv.filesystem.f_files > 0 ? (int)((1000.0 * (s->inf->priv.filesystem.f_files - s->inf->priv.filesystem.f_filesfree)) / (float)s->inf->priv.filesystem.f_files) : 0;
266
274
        s->inf->priv.filesystem.space_percent = s->inf->priv.filesystem.f_blocks > 0 ? (int)((1000.0 * (s->inf->priv.filesystem.f_blocks - s->inf->priv.filesystem.f_blocksfree)) / (float)s->inf->priv.filesystem.f_blocks) : 0;
267
275
        s->inf->priv.filesystem.inode_total   = s->inf->priv.filesystem.f_files - s->inf->priv.filesystem.f_filesfree;