| 1303 | static char partial_fname[MAXPATHLEN]; |
| 1304 | |
| 1305 | char *partial_dir_fname(const char *fname) |
| 1306 | { |
| 1307 | char *t = partial_fname; |
| 1308 | int sz = sizeof partial_fname; |
| 1309 | const char *fn; |
| 1310 | |
| 1311 | if ((fn = strrchr(fname, '/')) != NULL) { |
| 1312 | fn++; |
| 1313 | if (*partial_dir != '/') { |
| 1314 | int len = fn - fname; |
| 1315 | strncpy(t, fname, len); /* safe */ |
| 1316 | t += len; |
| 1317 | sz -= len; |
| 1318 | } |
| 1319 | } else |
| 1320 | fn = fname; |
| 1321 | if ((int)pathjoin(t, sz, partial_dir, fn) >= sz) |
| 1322 | return NULL; |
| 1323 | if (daemon_filter_list.head) { |
| 1324 | t = strrchr(partial_fname, '/'); |
| 1325 | *t = '\0'; |
| 1326 | if (check_filter(&daemon_filter_list, FLOG, partial_fname, 1) < 0) |
| 1327 | return NULL; |
| 1328 | *t = '/'; |
| 1329 | if (check_filter(&daemon_filter_list, FLOG, partial_fname, 0) < 0) |
| 1330 | return NULL; |
| 1331 | } |
| 1332 | |
| 1333 | return partial_fname; |
| 1334 | } |
| 1335 | |
| 1336 | /* If no --partial-dir option was specified, we don't need to do anything |
| 1337 | * (the partial-dir is essentially '.'), so just return success. */ |
no test coverage detected