[freenos] [freenos commit] r182 - Fix compilation of Ext2Create under OpenBSD: off_t casted to long long unsigned.

  • From: codesite-noreply@xxxxxxxxxx
  • To: freenos@xxxxxxxxxxxxx
  • Date: Thu, 02 Jul 2009 23:57:44 +0000

Author: nieklinnenbank
Date: Thu Jul  2 15:19:48 2009
New Revision: 182

Modified:
   trunk/srv/filesystem/ext2/Ext2Create.cpp

Log:
Fix compilation of Ext2Create under OpenBSD: off_t casted to long long unsigned. It seems that on OpenBSD the off_t variable is an 64-bit integer on Linux it's 32-bit.
We can fix this by casting it to 64-bit, and using %llu in the format.


Modified: trunk/srv/filesystem/ext2/Ext2Create.cpp
==============================================================================
--- trunk/srv/filesystem/ext2/Ext2Create.cpp    (original)
+++ trunk/srv/filesystem/ext2/Ext2Create.cpp    Thu Jul  2 15:19:48 2009
@@ -84,8 +84,9 @@
         exit(EXIT_FAILURE);
     }
     /* Debug out. */
-    printf("%s mode=%x size=%lu userId=%u groupId=%u\r\n",
-            inputFile, st.st_mode, st.st_size, st.st_uid, st.st_gid);
+    printf("%s mode=%x size=%llu userId=%u groupId=%u\r\n",
+            inputFile, st.st_mode, (long long unsigned)st.st_size,
+           st.st_uid, st.st_gid);

     /* Grab a new inode, or use the given number. */
     if (*number)

Other related posts:

  • » [freenos] [freenos commit] r182 - Fix compilation of Ext2Create under OpenBSD: off_t casted to long long unsigned. - codesite-noreply