This avoids "No such file or directory" messages in the ccache log when the
cache directory doesn't exist.
/*
- * Copyright (C) 2010-2011 Joel Rosdahl
+ * Copyright (C) 2010-2014 Joel Rosdahl
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
for (dir = 0; dir <= 0xF; dir++) {
struct counters *counters = counters_init(STATS_END);
+ struct stat st;
fname = format("%s/%1x/stats", cache_dir, dir);
+ if (stat(fname, &st) != 0) {
+ /* No point in trying to reset the stats file if it doesn't exist. */
+ free(fname);
+ continue;
+ }
if (lockfile_acquire(fname, lock_staleness_limit)) {
stats_read(fname, counters);
for (i = 0; stats_info[i].message; i++) {