Excise snprintf -> slprintf.
[kai/samba.git] / source3 / client / tree.c
index 872ec0f1ab849034cb44cdf06233c2480fc0b6ee..94bc6c0bfc0f81fbbf227a8aae9b457456a9dd12 100644 (file)
@@ -88,7 +88,7 @@ char *get_path(GtkWidget *item)
    * Now, build the path
    */
 
-  snprintf(path_string, sizeof(path_string), "smb:/");
+  slprintf(path_string, sizeof(path_string)-1, "smb:/");
 
   for (j = i - 1; j >= 0; j--) {
 
@@ -348,28 +348,36 @@ static void cb_select_child (GtkWidget *root_tree, GtkWidget *child,
 
          if (smbc_stat(path1, &st1) < 0) {
            
-           g_print("cb_select_child: Could not stat file %s, %s\n", path1, 
-                   strerror(errno));
+           if (errno != EBUSY) {
+             
+             g_print("cb_select_child: Could not stat file %s, %s\n", path1, 
+                     strerror(errno));
            
-           gtk_main_quit();
+             gtk_main_quit();
 
-           return;
+             return;
 
-         }
-
-         /* Now format each of the relevant things ... */
+           }
+           else {
 
-         snprintf(col2, sizeof(col2), "%s%s%s%s%s%s(%0X)",
-                  (st1.st_mode&0x20?"A":""),
-                  (st1.st_mode&0x10?"D":""),
-                  (st1.st_mode&0x08?"V":""),
-                  (st1.st_mode&0x04?"S":""),
-                  (st1.st_mode&0x02?"H":""),
-                  (st1.st_mode&0x01?"R":""),
-                  st1.st_mode); 
-         snprintf(col3, sizeof(col3), "%u", st1.st_size);
-         snprintf(col4, sizeof(col4), "%s", ctime(&st1.st_ctime));
+             strncpy(col2, "Device or resource busy", sizeof(col2));
 
+           }
+         }
+         else {
+           /* Now format each of the relevant things ... */
+
+           slprintf(col2, sizeof(col2)-1, "%s%s%s%s%s%s(%0X)",
+                    (st1.st_mode&0x20?"A":""),
+                    (st1.st_mode&0x10?"D":""),
+                    (st1.st_mode&0x08?"V":""),
+                    (st1.st_mode&0x04?"S":""),
+                    (st1.st_mode&0x02?"H":""),
+                    (st1.st_mode&0x01?"R":""),
+                    st1.st_mode); 
+           slprintf(col3, sizeof(col3)-1, "%u", st1.st_size);
+           slprintf(col4, sizeof(col4)-1, "%s", ctime(&st1.st_ctime));
+         }
        }
 
        break;
@@ -510,7 +518,7 @@ static void cb_wholenet(GtkWidget *item, gchar *signame)
 /* Should put up a dialog box to ask the user for username and password */
 
 static void 
-auth_fn(char *server, char *share,
+auth_fn(const char *server, const char *share,
        char *workgroup, int wgmaxlen, char *username, int unmaxlen,
        char *password, int pwmaxlen)
 {
@@ -538,7 +546,7 @@ int main( int   argc,
 
   /* Init the smbclient library */
 
-  err = smbc_init(auth_fn, "", 10);
+  err = smbc_init(auth_fn, 10);
 
   /* a generic toplevel window */
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);