From ea648052269ef3c389dfe8cabb86a5f794272d68 Mon Sep 17 00:00:00 2001 From: srittau Date: Mon, 9 Jun 2003 15:09:06 +0000 Subject: [PATCH] Head <-> 1.6 patch reduction. --- etc/afpd/afp_dsi.c | 8 +++++--- etc/afpd/afp_options.c | 8 ++++---- etc/afpd/appl.c | 44 ++++++++++++++++++++---------------------- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/etc/afpd/afp_dsi.c b/etc/afpd/afp_dsi.c index a53e0641..9f874284 100644 --- a/etc/afpd/afp_dsi.c +++ b/etc/afpd/afp_dsi.c @@ -1,5 +1,5 @@ /* - * $Id: afp_dsi.c,v 1.24.2.1 2003-06-06 19:43:12 srittau Exp $ + * $Id: afp_dsi.c,v 1.24.2.2 2003-06-09 15:09:06 srittau Exp $ * * Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu) * Copyright (c) 1990,1993 Regents of The University of Michigan. @@ -102,6 +102,7 @@ static void afp_dsi_timedown() it.it_interval.tv_usec = 0; it.it_value.tv_sec = 300; it.it_value.tv_usec = 0; + if ( setitimer( ITIMER_REAL, &it, 0 ) < 0 ) { LOG(log_error, logtype_afpd, "afp_timedown: setitimer: %s", strerror(errno) ); afp_dsi_die(1); @@ -232,11 +233,12 @@ void afp_over_dsi(AFPObj *obj) if (cmd == DSIFUNC_TICKLE) { /* so we don't get killed on the client side. */ - if (child.flags & CHILD_DIE) + if ((child.flags & CHILD_DIE)) dsi_tickle(dsi); continue; - } else if (!(child.flags & CHILD_DIE)) /* reset tickle timer */ + } else if (!(child.flags & CHILD_DIE)) { /* reset tickle timer */ setitimer(ITIMER_REAL, &dsi->timer, NULL); + } switch(cmd) { case DSIFUNC_CLOSE: diff --git a/etc/afpd/afp_options.c b/etc/afpd/afp_options.c index d00ab3fd..4cd7a2bb 100644 --- a/etc/afpd/afp_options.c +++ b/etc/afpd/afp_options.c @@ -1,5 +1,5 @@ /* - * $Id: afp_options.c,v 1.27.2.2 2003-06-09 14:53:14 srittau Exp $ + * $Id: afp_options.c,v 1.27.2.3 2003-06-09 15:09:06 srittau Exp $ * * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu) * Copyright (c) 1990,1993 Regents of The University of Michigan. @@ -438,17 +438,17 @@ int afp_options_parse(int ac, char **av, struct afp_options *options) perror( "gethostname" ); return 0; } - if (( p = strchr(options->hostname, '.' )) != 0 ) { + if (NULL != ( p = strchr(options->hostname, '.' )) ) { *p = '\0'; } - if (( p = strrchr( av[ 0 ], '/' )) == NULL ) { + if (NULL == ( p = strrchr( av[ 0 ], '/' )) ) { p = av[ 0 ]; } else { p++; } - while (( c = getopt( ac, av, OPTIONS )) != EOF ) { + while (EOF != ( c = getopt( ac, av, OPTIONS )) ) { switch ( c ) { case 'd' : options->flags |= OPTION_DEBUG; diff --git a/etc/afpd/appl.c b/etc/afpd/appl.c index 2e6c0b71..2d1e50c0 100644 --- a/etc/afpd/appl.c +++ b/etc/afpd/appl.c @@ -1,5 +1,5 @@ /* - * $Id: appl.c,v 1.8 2002-10-11 14:18:25 didg Exp $ + * $Id: appl.c,v 1.7.2.1 2003-06-09 15:09:06 srittau Exp $ * * Copyright (c) 1990,1993 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -152,8 +152,8 @@ char *path; strncpy( p, path, strlen( path )); while ( dir->d_parent != NULL ) { - p -= strlen( dir->d_m_name ) + 1; - strcpy( p, dir->d_m_name ); + p -= strlen( dir->d_name ) + 1; + strcpy( p, dir->d_name ); dir = dir->d_parent; } return( p ); @@ -170,8 +170,7 @@ int ibuflen, *rbuflen; int tfd, cc; u_int32_t did; u_int16_t vid, mplen; - struct path *path; - char *dtf, *p, *mp; + char *path, *dtf, *p, *mp; u_char creator[ 4 ]; u_char appltag[ 4 ]; char *mpath, *tempfile; @@ -181,13 +180,13 @@ int ibuflen, *rbuflen; memcpy( &vid, ibuf, sizeof( vid )); ibuf += sizeof( vid ); - if (( vol = getvolbyvid( vid )) == NULL ) { + if (NULL == ( vol = getvolbyvid( vid ))) { return( AFPERR_PARAM ); } memcpy( &did, ibuf, sizeof( did )); ibuf += sizeof( did ); - if (( dir = dirlookup( vol, did )) == NULL ) { + if (NULL == ( dir = dirlookup( vol, did )) ) { return( AFPERR_NOOBJ ); } @@ -197,10 +196,10 @@ int ibuflen, *rbuflen; memcpy( appltag, ibuf, sizeof( appltag )); ibuf += sizeof( appltag ); - if (( path = cname( vol, dir, &ibuf )) == NULL ) { + if (NULL == ( path = cname( vol, dir, &ibuf )) ) { return( AFPERR_NOOBJ ); } - if ( *path->m_name == '\0' ) { + if ( *path == '\0' ) { return( AFPERR_BADTYPE ); } @@ -217,7 +216,7 @@ int ibuflen, *rbuflen; return( AFPERR_PARAM ); } mpath = obj->newtmp; - mp = makemacpath( mpath, AFPOBJ_TMPSIZ, curdir, path->m_name ); + mp = makemacpath( mpath, AFPOBJ_TMPSIZ, curdir, path ); mplen = mpath + AFPOBJ_TMPSIZ - mp; /* write the new appl entry at start of temporary file */ @@ -257,8 +256,7 @@ int ibuflen, *rbuflen; int tfd, cc; u_int32_t did; u_int16_t vid, mplen; - struct path *path; - char *dtf, *mp; + char *path, *dtf, *mp; u_char creator[ 4 ]; char *tempfile, *mpath; @@ -267,23 +265,23 @@ int ibuflen, *rbuflen; memcpy( &vid, ibuf, sizeof( vid )); ibuf += sizeof( vid ); - if (( vol = getvolbyvid( vid )) == NULL ) { + if (NULL == ( vol = getvolbyvid( vid ))) { return( AFPERR_PARAM ); } memcpy( &did, ibuf, sizeof( did )); ibuf += sizeof( did ); - if (( dir = dirlookup( vol, did )) == NULL ) { + if (NULL == ( dir = dirlookup( vol, did )) ) { return( AFPERR_NOOBJ ); } memcpy( creator, ibuf, sizeof( creator )); ibuf += sizeof( creator ); - if (( path = cname( vol, dir, &ibuf )) == NULL ) { + if (NULL == ( path = cname( vol, dir, &ibuf )) ) { return( AFPERR_NOOBJ ); } - if ( *path->m_name == '\0' ) { + if ( *path == '.' ) { return( AFPERR_BADTYPE ); } @@ -300,7 +298,7 @@ int ibuflen, *rbuflen; return( AFPERR_PARAM ); } mpath = obj->newtmp; - mp = makemacpath( mpath, AFPOBJ_TMPSIZ, curdir, path->m_name ); + mp = makemacpath( mpath, AFPOBJ_TMPSIZ, curdir, path ); mplen = mpath + AFPOBJ_TMPSIZ - mp; cc = copyapplfile( sa.sdt_fd, tfd, mp, mplen ); close( tfd ); @@ -322,6 +320,7 @@ AFPObj *obj; char *ibuf, *rbuf; int ibuflen, *rbuflen; { + struct stat st; struct vol *vol; char *p, *q; int cc, buflen; @@ -329,13 +328,12 @@ int ibuflen, *rbuflen; u_char creator[ 4 ]; u_char appltag[ 4 ]; char *buf, *cbuf; - struct path *path; - + ibuf += 2; memcpy( &vid, ibuf, sizeof( vid )); ibuf += sizeof( vid ); - if (( vol = getvolbyvid( vid )) == NULL ) { + if (NULL == ( vol = getvolbyvid( vid )) ) { *rbuflen = 0; return( AFPERR_PARAM ); } @@ -436,17 +434,17 @@ int ibuflen, *rbuflen; memcpy( q, p, len ); q = cbuf; - if (( path = cname( vol, vol->v_dir, &q )) == NULL ) { + if (( p = cname( vol, vol->v_dir, &q )) == NULL ) { *rbuflen = 0; return( AFPERR_NOITEM ); } - if ( *path->m_name == '\0' || path->st_errno ) { + if ( stat( mtoupath(vol, p), &st ) < 0 ) { *rbuflen = 0; return( AFPERR_NOITEM ); } buflen = *rbuflen - sizeof( bitmap ) - sizeof( appltag ); - if ( getfilparams(vol, bitmap, path, curdir, rbuf + sizeof( bitmap ) + + if ( getfilparams(vol, bitmap, p, curdir, &st, rbuf + sizeof( bitmap ) + sizeof( appltag ), &buflen ) != AFP_OK ) { *rbuflen = 0; return( AFPERR_BITMAP ); -- 2.39.2