zip: move to github
[packages.git] / utils / bonnie++ / patches / 002-add-verbose-error-messages.patch
1 --- a/bon_file.cpp
2 +++ b/bon_file.cpp
3 @@ -464,25 +464,37 @@ int COpenTest::delete_sequential(BonTime
4      }
5      if(m_number_directories != 1)
6      {
7 -      if(chdir("..") || rmdir(buf))
8 +      if(chdir(".."))
9        {
10 +        io_error("chdir");
11 +        return -1;
12 +      }
13 +      if(rmdir(buf))
14 +      {
15 +        fprintf(stderr, "Unable to delete directory '%s'\n", buf);
16          io_error("rmdir");
17          return -1;
18        }
19      }
20    }
21 -  if(chdir("..") || rmdir(m_dirname))
22 +  if(count != m_number)
23    {
24 -    io_error("rmdir");
25 +    fprintf(stderr, "Expected %d files but only got %d\n", m_number, count);
26      return -1;
27    }
28 -  delete m_dirname;
29 -  m_dirname = NULL;
30 -  if(count != m_number)
31 +  if(chdir(".."))
32    {
33 -    fprintf(stderr, "Expected %d files but only got %d\n", m_number, count);
34 +    io_error("chdir");
35 +    return -1;
36 +  }
37 +  if(rmdir(m_dirname))
38 +  {
39 +    fprintf(stderr, "Unable to delete directory '%s'\n", m_dirname);
40 +    io_error("rmdir");
41      return -1;
42    }
43 +  delete m_dirname;
44 +  m_dirname = NULL;
45    sync();
46    timer.stop_and_record(DelSeq);
47    timer.add_latency(DelSeq, dur.getMax());