1 | /* |
1 | /* |
2 | * static char *rcsid_map_c = |
2 | * static char *rcsid_map_c = |
3 | * "$Id: map.C,v 1.15 2006/08/30 08:28:32 root Exp $"; |
3 | * "$Id: map.C,v 1.16 2006/08/30 16:30:37 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
173 | * Can not use strcat because we need to cycle through |
173 | * Can not use strcat because we need to cycle through |
174 | * all the names. |
174 | * all the names. |
175 | */ |
175 | */ |
176 | endbuf = buf + strlen(buf); |
176 | endbuf = buf + strlen(buf); |
177 | |
177 | |
178 | for (i = 0; i < NROF_COMPRESS_METHODS; i++) { |
|
|
179 | if (uncomp[i][0]) |
|
|
180 | strcpy(endbuf, uncomp[i][0]); |
|
|
181 | else |
|
|
182 | *endbuf = '\0'; |
|
|
183 | if (!stat (buf, &statbuf)) |
178 | if (stat (buf, &statbuf)) |
184 | break; |
|
|
185 | } |
|
|
186 | if (i == NROF_COMPRESS_METHODS) |
|
|
187 | return (-1); |
179 | return -1; |
188 | if (!S_ISREG (statbuf.st_mode)) |
180 | if (!S_ISREG (statbuf.st_mode)) |
189 | return (-1); |
181 | return (-1); |
190 | |
182 | |
191 | if (((statbuf.st_mode & S_IRGRP) && getegid() == statbuf.st_gid) || |
183 | if (((statbuf.st_mode & S_IRGRP) && getegid() == statbuf.st_gid) || |
192 | ((statbuf.st_mode & S_IRUSR) && geteuid() == statbuf.st_uid) || |
184 | ((statbuf.st_mode & S_IRUSR) && geteuid() == statbuf.st_uid) || |