comparison utils.c @ 7:8339ab15527d

Add running/stopped containers global statistics and refactor some things
author Louis Opter <louis@dotcloud.com>
date Sat, 01 Jan 2011 17:46:40 +0100
parents 50215911acb3
children 3a1977ecccc7
comparison
equal deleted inserted replaced
6:e2b88f50e136 7:8339ab15527d
27 27
28 return (dest); 28 return (dest);
29 } 29 }
30 30
31 int 31 int
32 _lxcst_isdir(const struct _lxcst_controller *hdl, const struct dirent *d) 32 _lxcst_isdir(const char *path)
33 { 33 {
34 struct stat sb; 34 struct stat sb;
35 char buf[PATH_MAX];
36 35
37 _lxcst_join_path(buf, sizeof(buf), hdl->cgroup_dir, d->d_name); 36 if (stat(path, &sb) == -1) {
38 37 warn("can't stat path: %s", path);
39 if (stat(buf, &sb) == -1) {
40 warn("can't stat file: %s", buf);
41 return (0); 38 return (0);
42 } 39 }
43 40
44 return (sb.st_mode & S_IFDIR); 41 return (sb.st_mode & S_IFDIR);
45 } 42 }