mcserv and mcfs exchange st_dev instead of st_rdev. This makes stats on

device files useless. Fixing this does not break anything, but adds the
ability to copy device files properly. Ideally, both st_dev and st_rdev
should be returned for those programs that use the vfs to properly
recreate hardlinks. Used idea was it to only return one if these???

mcserv also does not return the amount written in a write - fixed

mc should now interface correctly with secure-mcserv in basic non-secure
mode
This commit is contained in:
Paul Sheer 1999-02-16 10:16:59 +00:00
parent 53cfcf095d
commit 9e4cd04ea1
3 changed files with 39 additions and 15 deletions

View File

@ -1,3 +1,13 @@
Tue Feb 16 12:11:04 1999 Paul Sheer <psheer@obsidian.co.za>
* mcserv.c, mcfs.c: mcserv and mcfs exchange st_dev instead
of st_rdev. This makes stats on device files useless. Fixing
this does not break anything, but adds the ability to copy
device files properly. Ideally, both st_dev and st_rdev should
be returned for those programs that use the vfs to properly
recreate hardlinks. Whose idea was it to only return one of
these???
1999-02-12 Sergey Korshunoff <seyko@p5.f434.n5020.z2.fidonet.org>
* unlha.in: Fix the problem of having incorrect pathnames when

View File

@ -813,12 +813,12 @@ static int get_stat_info (mcfs_connection *mc, struct stat *buf)
long mylong;
int sock = mc->sock;
#ifdef HAVE_ST_RDEV
buf->st_rdev = 0;
#endif
buf->st_dev = 0;
rpc_get (sock, RPC_INT, &mylong, RPC_END);
buf->st_dev = mylong;
#ifdef HAVE_ST_RDEV
buf->st_rdev = mylong;
#endif
rpc_get (sock, RPC_INT, &mylong, RPC_END);
buf->st_ino = mylong;
rpc_get (sock, RPC_INT, &mylong, RPC_END);

View File

@ -208,19 +208,29 @@ void do_read (void)
void do_write (void)
{
int handle, count, status;
char buffer [8192];
int handle, count, status, written = 0;
char buf[8192];
rpc_get (msock, RPC_INT, &handle, RPC_INT, &count, RPC_END);
status = 0;
while (count){
while (count) {
int nbytes = count > 8192 ? 8192 : count;
rpc_get (msock, RPC_BLOCK, nbytes, buffer, RPC_END);
status = write (handle, buffer, nbytes);
rpc_get (msock, RPC_BLOCK, nbytes, buf, RPC_END);
status = write (handle, buf, nbytes);
if (status < 0) {
send_status (status, errno);
return;
}
/* FIXED: amount written must be returned to caller */
written += status;
if (status < nbytes) {
send_status (written, errno);
return;
}
count -= nbytes;
}
send_status (status, errno);
send_status (written, errno);
}
void do_lseek (void)
@ -298,7 +308,7 @@ void send_time (int sock, time_t time)
void send_stat_info (struct stat *st)
{
int mylong;
long mylong;
int blocks =
#ifdef HAVE_ST_BLOCKS
st->st_blocks;
@ -306,8 +316,12 @@ void send_stat_info (struct stat *st)
st->st_size / 1024;
#endif
mylong = st->st_dev;
rpc_send (msock, RPC_INT, (long) st->st_dev,
#ifdef HAVE_ST_RDEV
mylong = st->st_rdev;
#else
mylong = 0;
#endif
rpc_send (msock, RPC_INT, (long) mylong,
RPC_INT, (long) st->st_ino,
RPC_INT, (long) st->st_mode,
RPC_INT, (long) st->st_nlink,