summaryrefslogtreecommitdiff
blob: 2af76d8f8c80e1385fed8f2f9e9e1de1ca5d4ffc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
--- getc_putc.cpp.old	2004-09-15 02:37:21.500489552 +0200
+++ getc_putc.cpp	2004-09-15 02:40:58.623481840 +0200
@@ -165,7 +165,11 @@
   int size = 0, wrote;
   while(size < file_size)
   {
-    wrote = write(FILE_FD, buf, min(sizeof(buf), (unsigned int)file_size - size));
+    //wrote = write(FILE_FD, buf, min(sizeof(buf), (unsigned int)file_size - size));
+    /*
+     * gcc doesn't like above line. ? : should do the job as good as min()...
+     */
+    wrote = write(FILE_FD, buf, (sizeof(buf) < (file_size - size) ? (sizeof(buf)):(file_size - size)));
     if(wrote < 0)
     {
       fprintf(stderr, "Can't extend file - disk full?\n");