- while((entry = readdir(workdir)) != NULL) {
- if(is_dot_or_dotdot(entry->d_name)) {
- continue;
- }
-
- if((l = strlen(entry->d_name)) < 7 ) {
- continue;
- }
-
- if(strncmp(&entry->d_name[l-4],".tmp",4) != 0) {
- continue;
- }
-
- tmpname = newvstralloc(tmpname,
- dirname, "/", entry->d_name,
- NULL);
-
- destname = newstralloc(destname, tmpname);
- destname[dl + 1 + l - 4] = '\0';
-
- amfree(hostname);
- amfree(diskname);
- filetype = holding_file_read_header(tmpname, &hostname, &diskname, &level, NULL);
- amfree(tmpname);
- if(filetype != F_DUMPFILE) {
- continue;
- }
-
- dp = lookup_disk(hostname, diskname);
-
- if (dp == NULL) {
- continue;
- }
-
- if(level < 0 || level > 9) {
- continue;
- }
-
- if(rename_tmp_holding(destname, 0)) {
- get_info(dp->host->hostname, dp->name, &info);
- info.command &= ~FORCE_BUMP;
- info.command |= FORCE_NO_BUMP;
- if(put_info(dp->host->hostname, dp->name, &info)) {
- error("could not put info record for %s:%s: %s",
- dp->host->hostname, dp->name, strerror(errno));
- /*NOTREACHED*/
- }
- } else {
- fprintf(stderr,"rename_tmp_holding(%s) failed\n", destname);
- }