a small patch for aimage

4 views
Skip to first unread message

Greg Freemyer

unread,
Dec 12, 2011, 6:43:13 PM12/12/11
to aff-d...@googlegroups.com
Simson,

I just packaged up aimage-3.2.5 for openSUSE. I'll send it to their
security repo as soon as I test it a little.

There were a couple of gcc warnings it considered too bad to allow me
to build a rpm.

Here's the small patch I'm applying to make it work:

===
diff -rupN aimage-3.2.5.orig/src/aimage.cpp aimage-3.2.5/src/aimage.cpp
--- aimage-3.2.5.orig/src/aimage.cpp 2010-12-17 08:49:50.000000000 -0500
+++ aimage-3.2.5/src/aimage.cpp 2011-12-12 18:30:07.000000000 -0500
@@ -839,7 +839,7 @@ int verify_file(const char *file1,const
return 0;
}

-int wipe(const char *file1)
+void wipe(const char *file1)
{
AFFILE *af1 = af_open(file1,O_RDWR,0777);
unsigned char *zbuf = (unsigned char *)calloc(AFF_DEFAULT_PAGESIZE,1);
diff -rupN aimage-3.2.5.orig/src/imager.cpp aimage-3.2.5/src/imager.cpp
--- aimage-3.2.5.orig/src/imager.cpp 2011-08-17 19:30:12.000000000 -0400
+++ aimage-3.2.5/src/imager.cpp 2011-12-12 18:30:49.000000000 -0500
@@ -662,7 +662,7 @@ void imager::start_recover_scan()
#endif
while(missing_pages>0){
int random_page = random() % num_pages;
- while(pages[random_page]!=0) random_page = (++random_page) % num_pages;
+ while(pages[random_page]!=0) random_page = (random_page+1) % num_pages;
printf("*** try for page %d\n",random_page);
uint64 start_sector = random_page * sectors_per_page;
uint64 end_sector = start_sector + sectors_per_page;
========

The int => void change looks trivial one way or the other, but the
++random_page change prevents a warning that says the results of the
expression are undefined.

Hope that helps,
Greg

Reply all
Reply to author
Forward
0 new messages