~ubuntu-branches/debian/squeeze/openttd/squeeze

« back to all changes in this revision

Viewing changes to src/os/unix/unix.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Matthijs Kooijman
  • Date: 2010-07-01 08:14:02 UTC
  • mfrom: (1.1.12 upstream)
  • Revision ID: james.westby@ubuntu.com-20100701081402-98jmva0t3sqywxmi
Tags: 1.0.2-1
* [00c4efe] New upstream release 1.0.2.
* [c7b38fd] Break older openttd versions instead of Conflicting with
  them.
* [36bd61f] Bump standards version to 3.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: unix.cpp 18809 2010-01-15 16:41:15Z rubidium $ */
 
1
/* $Id: unix.cpp 19857 2010-05-18 21:44:47Z rubidium $ */
2
2
 
3
3
/*
4
4
 * This file is part of OpenTTD.
92
92
bool FiosIsValidFile(const char *path, const struct dirent *ent, struct stat *sb)
93
93
{
94
94
        char filename[MAX_PATH];
95
 
 
 
95
        int res;
96
96
#if defined(__MORPHOS__) || defined(__AMIGAOS__)
97
97
        /* On MorphOS or AmigaOS paths look like: "Volume:directory/subdirectory" */
98
98
        if (FiosIsRoot(path)) {
99
 
                snprintf(filename, lengthof(filename), "%s:%s", path, ent->d_name);
 
99
                res = snprintf(filename, lengthof(filename), "%s:%s", path, ent->d_name);
100
100
        } else // XXX - only next line!
101
101
#else
102
102
        assert(path[strlen(path) - 1] == PATHSEPCHAR);
103
103
        if (strlen(path) > 2) assert(path[strlen(path) - 2] != PATHSEPCHAR);
104
104
#endif
105
 
        snprintf(filename, lengthof(filename), "%s%s", path, ent->d_name);
 
105
        res = snprintf(filename, lengthof(filename), "%s%s", path, ent->d_name);
 
106
 
 
107
        /* Could we fully concatenate the path and filename? */
 
108
        if (res >= (int)lengthof(filename) || res < 0) return false;
106
109
 
107
110
        return stat(filename, sb) == 0;
108
111
}