1
1
(loaddir): Symplify.
(fake_share_stat): Declare server_url const.
Use "%4o" for st_mode.
(fake_server_stat): Likewise.  Return -1 if server_list != True.
Этот коммит содержится в:
Andrew V. Samoilov 2001-10-30 15:24:01 +00:00
родитель 0b88e8d6ce
Коммит 2cc50a14d6
2 изменённых файлов: 18 добавлений и 12 удалений

Просмотреть файл

@ -1,8 +1,14 @@
2001-10-30 Andrew V. Samoilov <kai@cmail.ru> 2001-10-30 Andrew V. Samoilov <kai@cmail.ru>
* smbfs.c: Include <config.h> before everything else. * smbfs.c: Include <config.h> before everything else.
Don't include "tcputil.h".
(myhostname): Declare extern. (myhostname): Declare extern.
(loaddir): Symplify.
(fake_share_stat): Declare server_url const.
Use "%4o" for st_mode.
(fake_server_stat): Likewise. Return -1 if server_list != True.
(get_master_browser): Declare ipzero extern. By drk@sgi.com. (get_master_browser): Declare ipzero extern. By drk@sgi.com.
http://bugzilla.gnome.org/show_bug.cgi?id=60933 http://bugzilla.gnome.org/show_bug.cgi?id=60933

Просмотреть файл

@ -39,7 +39,6 @@
#include "vfs.h" #include "vfs.h"
#include "smbfs.h" #include "smbfs.h"
#include "tcputil.h"
#include "../src/dialog.h" #include "../src/dialog.h"
#define SMBFS_MAX_CONNECTIONS 16 #define SMBFS_MAX_CONNECTIONS 16
@ -1192,7 +1191,7 @@ smbfs_opendir (vfs *me, char *dirname)
} }
static int static int
fake_server_stat(char *server_url, const char *path, struct stat *buf) fake_server_stat(const char *server_url, const char *path, struct stat *buf)
{ {
dir_entry *dentry; dir_entry *dentry;
char *p; char *p;
@ -1204,23 +1203,26 @@ fake_server_stat(char *server_url, const char *path, struct stat *buf)
if (!smbfs_loaddir(current_info)); /* browse host */ if (!smbfs_loaddir(current_info)); /* browse host */
return -1; return -1;
} }
if (current_info->server_list == True) {
dentry = current_info->entries; dentry = current_info->entries;
DEBUG(4, ("fake stat for SERVER \"%s\"\n", path)); DEBUG(4, ("fake stat for SERVER \"%s\"\n", path));
while (dentry) { while (dentry) {
if (strcmp(dentry->text, path) == 0) { if (strcmp(dentry->text, path) == 0) {
DEBUG(4, ("fake_server_stat: %s:%d\n", DEBUG(4, ("fake_server_stat: %s:%4o\n",
dentry->text, dentry->my_stat.st_mode)); dentry->text, dentry->my_stat.st_mode));
memcpy(buf, &dentry->my_stat, sizeof(struct stat)); memcpy(buf, &dentry->my_stat, sizeof(struct stat));
return 0; return 0;
} }
dentry = dentry->next; dentry = dentry->next;
} }
}
my_errno = ENOENT; my_errno = ENOENT;
return -1; return -1;
} }
static int static int
fake_share_stat(char *server_url, char *path, struct stat *buf) fake_share_stat(const char *server_url, char *path, struct stat *buf)
{ {
dir_entry *dentry; dir_entry *dentry;
if (strlen(path) < strlen(server_url)) if (strlen(path) < strlen(server_url))
@ -1239,7 +1241,7 @@ fake_share_stat(char *server_url, char *path, struct stat *buf)
DEBUG(3, ("fake_share_stat: %s on %s\n", path, server_url)); DEBUG(3, ("fake_share_stat: %s on %s\n", path, server_url));
while (dentry) { while (dentry) {
if (strcmp(dentry->text, path) == 0) { if (strcmp(dentry->text, path) == 0) {
DEBUG(6, ("fake_share_stat: %s:%d\n", DEBUG(6, ("fake_share_stat: %s:%4o\n",
dentry->text, dentry->my_stat.st_mode)); dentry->text, dentry->my_stat.st_mode));
memcpy(buf, &dentry->my_stat, sizeof(struct stat)); memcpy(buf, &dentry->my_stat, sizeof(struct stat));
return 0; return 0;
@ -1436,14 +1438,12 @@ loaddir(vfs *me, const char *path)
{ {
void *info; void *info;
char *mypath, *p; char *mypath, *p;
mypath = g_strdup(path); mypath = g_strdup(path);
p = mypath; p = strchr(mypath, '/');
if (*p == '/')
p++; if (p > mypath)
while (strchr(p, '/')) *p = 0;
p++;
if (p-mypath > 1)
*--p = 0;
DEBUG(6, ("loaddir(%s)\n", mypath)); DEBUG(6, ("loaddir(%s)\n", mypath));
smbfs_chdir(me, mypath); smbfs_chdir(me, mypath);
info = smbfs_opendir (me, mypath); info = smbfs_opendir (me, mypath);