CVS: rdesktop disk.c,1.60,1.61
Peter Ã
strand <[email protected]> Wed, 04 Apr 2007 05:28:59 -0700
| Newsgroups | gmane.network.rdesktop.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv2761
Modified Files:
disk.c
Log Message:
Cleanup: Using same variable name for all "struct stat" buffers, to
avoid confusion. (The variable name fstat also collides with the
function with the same name.)
Index: disk.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/disk.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -C2 -d -r1.60 -r1.61
*** disk.c 8 Jan 2007 04:47:05 -0000 1.60
--- disk.c 4 Apr 2007 12:28:57 -0000 1.61
***************
*** 154,163 ****
static time_t
! get_create_time(struct stat *st)
{
time_t ret, ret1;
! ret = MIN(st->st_ctime, st->st_mtime);
! ret1 = MIN(ret, st->st_atime);
if (ret1 != (time_t) 0)
--- 154,163 ----
static time_t
! get_create_time(struct stat *filestat)
{
time_t ret, ret1;
! ret = MIN(filestat->st_ctime, filestat->st_mtime);
! ret1 = MIN(ret, filestat->st_atime);
if (ret1 != (time_t) 0)
***************
*** 263,267 ****
{
int ret;
! struct stat statbuf;
ret = open(pathname, flags, mode);
--- 263,267 ----
{
int ret;
! struct stat filestat;
ret = open(pathname, flags, mode);
***************
*** 292,296 ****
/* Retry with GUARDED semantics */
! if (stat(pathname, &statbuf) != -1)
{
/* File exists */
--- 292,296 ----
/* Retry with GUARDED semantics */
! if (stat(pathname, &filestat) != -1)
{
/* File exists */
***************
*** 931,935 ****
{
struct fileinfo *pfinfo;
! struct stat buf;
struct dirent *dp;
char *fullname;
--- 931,935 ----
{
struct fileinfo *pfinfo;
! struct stat filestat;
struct dirent *dp;
char *fullname;
***************
*** 937,947 ****
pfinfo = &(g_fileinfo[handle]);
! if (fstat(handle, &buf) < 0)
{
perror("NotifyInfo");
return RD_STATUS_ACCESS_DENIED;
}
! p->modify_time = buf.st_mtime;
! p->status_time = buf.st_ctime;
p->num_entries = 0;
p->total_time = 0;
--- 937,947 ----
pfinfo = &(g_fileinfo[handle]);
! if (fstat(handle, &filestat) < 0)
{
perror("NotifyInfo");
return RD_STATUS_ACCESS_DENIED;
}
! p->modify_time = filestat.st_mtime;
! p->status_time = filestat.st_ctime;
p->num_entries = 0;
p->total_time = 0;
***************
*** 964,970 ****
sprintf(fullname, "%s/%s", pfinfo->path, dp->d_name);
! if (!stat(fullname, &buf))
{
! p->total_time += (buf.st_mtime + buf.st_ctime);
}
--- 964,970 ----
sprintf(fullname, "%s/%s", pfinfo->path, dp->d_name);
! if (!stat(fullname, &filestat))
{
! p->total_time += (filestat.st_mtime + filestat.st_ctime);
}
***************
*** 1116,1120 ****
DIR *pdir;
struct dirent *pdirent;
! struct stat fstat;
struct fileinfo *pfinfo;
--- 1116,1120 ----
DIR *pdir;
struct dirent *pdirent;
! struct stat filestat;
struct fileinfo *pfinfo;
***************
*** 1146,1150 ****
sprintf(fullpath, "%s/%s", dirname, pdirent->d_name);
! if (stat(fullpath, &fstat))
{
switch (errno)
--- 1146,1150 ----
sprintf(fullpath, "%s/%s", dirname, pdirent->d_name);
! if (stat(fullpath, &filestat))
{
switch (errno)
***************
*** 1154,1158 ****
case EACCES:
/* These are non-fatal errors. */
! memset(&fstat, 0, sizeof(fstat));
break;
default:
--- 1154,1158 ----
case EACCES:
/* These are non-fatal errors. */
! memset(&filestat, 0, sizeof(filestat));
break;
default:
***************
*** 1165,1169 ****
}
! if (S_ISDIR(fstat.st_mode))
file_attributes |= FILE_ATTRIBUTE_DIRECTORY;
if (pdirent->d_name[0] == '.')
--- 1165,1169 ----
}
! if (S_ISDIR(filestat.st_mode))
file_attributes |= FILE_ATTRIBUTE_DIRECTORY;
if (pdirent->d_name[0] == '.')
***************
*** 1171,1175 ****
if (!file_attributes)
file_attributes |= FILE_ATTRIBUTE_NORMAL;
! if (!(fstat.st_mode & S_IWUSR))
file_attributes |= FILE_ATTRIBUTE_READONLY;
--- 1171,1175 ----
if (!file_attributes)
file_attributes |= FILE_ATTRIBUTE_NORMAL;
! if (!(filestat.st_mode & S_IWUSR))
file_attributes |= FILE_ATTRIBUTE_READONLY;
***************
*** 1177,1199 ****
out_uint8s(out, 8); /* unknown zero */
! seconds_since_1970_to_filetime(get_create_time(&fstat), &ft_high, &ft_low);
out_uint32_le(out, ft_low); /* create time */
out_uint32_le(out, ft_high);
! seconds_since_1970_to_filetime(fstat.st_atime, &ft_high, &ft_low);
out_uint32_le(out, ft_low); /* last_access_time */
out_uint32_le(out, ft_high);
! seconds_since_1970_to_filetime(fstat.st_mtime, &ft_high, &ft_low);
out_uint32_le(out, ft_low); /* last_write_time */
out_uint32_le(out, ft_high);
! seconds_since_1970_to_filetime(fstat.st_ctime, &ft_high, &ft_low);
out_uint32_le(out, ft_low); /* change_write_time */
out_uint32_le(out, ft_high);
! out_uint32_le(out, fstat.st_size); /* filesize low */
out_uint32_le(out, 0); /* filesize high */
! out_uint32_le(out, fstat.st_size); /* filesize low */
out_uint32_le(out, 0); /* filesize high */
out_uint32_le(out, file_attributes);
--- 1177,1200 ----
out_uint8s(out, 8); /* unknown zero */
! seconds_since_1970_to_filetime(get_create_time(&filestat), &ft_high,
! &ft_low);
out_uint32_le(out, ft_low); /* create time */
out_uint32_le(out, ft_high);
! seconds_since_1970_to_filetime(filestat.st_atime, &ft_high, &ft_low);
out_uint32_le(out, ft_low); /* last_access_time */
out_uint32_le(out, ft_high);
! seconds_since_1970_to_filetime(filestat.st_mtime, &ft_high, &ft_low);
out_uint32_le(out, ft_low); /* last_write_time */
out_uint32_le(out, ft_high);
! seconds_since_1970_to_filetime(filestat.st_ctime, &ft_high, &ft_low);
out_uint32_le(out, ft_low); /* change_write_time */
out_uint32_le(out, ft_high);
! out_uint32_le(out, filestat.st_size); /* filesize low */
out_uint32_le(out, 0); /* filesize high */
! out_uint32_le(out, filestat.st_size); /* filesize low */
out_uint32_le(out, 0); /* filesize high */
out_uint32_le(out, file_attributes);
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV