[maemo-commits] [maemo-commits] r18011 - projects/connectivity/osso-obc/trunk/src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Apr 3 21:14:44 EEST 2009
Author: jh
Date: 2009-04-03 21:14:42 +0300 (Fri, 03 Apr 2009)
New Revision: 18011

Modified:
   projects/connectivity/osso-obc/trunk/src/get.c
   projects/connectivity/osso-obc/trunk/src/put.c
Log:
Get rid of gcc 4.x warnings

Modified: projects/connectivity/osso-obc/trunk/src/get.c
===================================================================
--- projects/connectivity/osso-obc/trunk/src/get.c	2009-04-03 14:21:04 UTC (rev 18010)
+++ projects/connectivity/osso-obc/trunk/src/get.c	2009-04-03 18:14:42 UTC (rev 18011)
@@ -107,7 +107,7 @@
             break;
         }
 
-        write(fd, buf, bytes);
+        bytes = write(fd, buf, bytes);
     }
 
 out:
@@ -158,13 +158,20 @@
             return FALSE;
         }
 
-        chdir(local);
+        if (chdir(local) < 0) {
+            printf("chdir to %s failed: %s.\n", local, strerror(errno));
+            gw_obex_chdir(ctx->obex, "..", NULL);
+            if (chdir("..") < 0)
+                printf("chdir(..) failed: %s.\n", strerror(errno));
+            return FALSE;
+	}
 
         dir = fl_list_get(ctx, NULL, FALSE, err);
         if (dir == NULL && err && *err >= 0x40) {
             printf("Getting folder-listing failed.\n");
             gw_obex_chdir(ctx->obex, "..", NULL);
-            chdir("..");
+            if (chdir("..") < 0)
+                printf("chdir(..) failed: %s.\n", strerror(errno));
             return FALSE;
         }
 
@@ -174,13 +181,15 @@
            if (!get_object(ctx, e->name, type, NULL, e->dir, err)) {
                fl_list_free(dir);
                gw_obex_chdir(ctx->obex, "..", err);
-               chdir("..");
+               if (chdir("..") < 0)
+                   printf("chdir(..) failed: %s.\n", strerror(errno));
                return FALSE;
            }
         }
 
         fl_list_free(dir);
-        chdir("..");
+        if (chdir("..") < 0)
+            printf("chdir(..) failed: %s.\n", strerror(errno));
 
         if (!gw_obex_chdir(ctx->obex, "..", err)) {
             printf("Could not chdir to .. (reported directory may be wrong)\n");

Modified: projects/connectivity/osso-obc/trunk/src/put.c
===================================================================
--- projects/connectivity/osso-obc/trunk/src/put.c	2009-04-03 14:21:04 UTC (rev 18010)
+++ projects/connectivity/osso-obc/trunk/src/put.c	2009-04-03 18:14:42 UTC (rev 18011)
@@ -29,6 +29,7 @@
 #include <fcntl.h>
 #include <dirent.h>
 #include <time.h>
+#include <string.h>
 
 #include <glib.h>
 
@@ -148,13 +149,15 @@
 
         if (!gw_obex_mkdir(ctx->obex, name, err)) {
             printf("Could not create remote directory %s\n", name);
-            chdir("..");
+            if (chdir("..") < 0)
+                printf("chdir(..) failed: %s\n", strerror(errno));
             return FALSE;
         }
 
         if (!gw_obex_chdir(ctx->obex, name, err)) {
             printf("Could not change to remote directory %s\n", name);
-            chdir("..");
+            if (chdir("..") < 0)
+                printf("chdir(..) failed\n: %s", strerror(errno));
             return FALSE;
         }
 
@@ -162,7 +165,8 @@
         if (dp == NULL) {
             printf("Could not open local directory %s: %s\n", name,
                     g_strerror(errno));
-            chdir("..");
+            if (chdir("..") < 0)
+                printf("chdir(..) failed\n: %s", strerror(errno));
             gw_obex_chdir(ctx->obex, "..", NULL);
             if (err)
                 *err = GW_OBEX_ERROR_LOCAL_ACCESS;
@@ -186,14 +190,16 @@
             if (!put_object(ctx, ep->d_name, NULL, dir, err)) {
                 closedir(dp);
                 gw_obex_chdir(ctx->obex, "..", NULL);
-                chdir("..");
+                if (chdir("..") < 0)
+                    printf("chdir(..) failed: %s\n", strerror(errno));
                 return FALSE;
             }
         }
 
         closedir(dp);
         gw_obex_chdir(ctx->obex, "..", NULL);
-        chdir("..");
+        if (chdir("..") < 0)
+            printf("chdir(..) failed: %s\n", strerror(errno));
 
         return TRUE;
     }
@@ -277,7 +283,7 @@
     printf("%s [-r] [-t <type>] <file..>\n"
            "Send local file(s)\n"
            "Parameters:\n"
-           "-r\tRecursive\n",
+           "-r\tRecursive\n"
            "-t\tObject type\n", name);
 }
 


More information about the maemo-commits mailing list