diff options
Diffstat (limited to 'archivers/pax/files/tables.c')
-rw-r--r-- | archivers/pax/files/tables.c | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/archivers/pax/files/tables.c b/archivers/pax/files/tables.c index 8b675ca2b00..c117ce9cd7d 100644 --- a/archivers/pax/files/tables.c +++ b/archivers/pax/files/tables.c @@ -1,4 +1,4 @@ -/* $NetBSD: tables.c,v 1.6 2005/12/01 03:00:01 minskim Exp $ */ +/* $NetBSD: tables.c,v 1.7 2007/03/08 17:18:18 rillig Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -48,7 +48,7 @@ #if 0 static char sccsid[] = "@(#)tables.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: tables.c,v 1.6 2005/12/01 03:00:01 minskim Exp $"); +__RCSID("$NetBSD: tables.c,v 1.7 2007/03/08 17:18:18 rillig Exp $"); #endif #endif /* not lint */ @@ -147,12 +147,12 @@ int lnk_start(void) { if (ltab != NULL) - return(0); + return 0; if ((ltab = (HRDLNK **)calloc(L_TAB_SZ, sizeof(HRDLNK *))) == NULL) { tty_warn(1, "Cannot allocate memory for hard link table"); - return(-1); + return -1; } - return(0); + return 0; } /* @@ -175,12 +175,12 @@ chk_lnk(ARCHD *arcn) u_int indx; if (ltab == NULL) - return(-1); + return -1; /* * ignore those nodes that cannot have hard links */ if ((arcn->type == PAX_DIR) || (arcn->sb.st_nlink <= 1)) - return(0); + return 0; /* * hash inode number and look for this file @@ -222,7 +222,7 @@ chk_lnk(ARCHD *arcn) (void)free((char *)pt->name); (void)free((char *)pt); } - return(1); + return 1; } } @@ -237,13 +237,13 @@ chk_lnk(ARCHD *arcn) pt->nlink = arcn->sb.st_nlink; pt->fow = ltab[indx]; ltab[indx] = pt; - return(0); + return 0; } (void)free((char *)pt); } tty_warn(1, "Hard link table out of memory"); - return(-1); + return -1; } /* @@ -371,10 +371,10 @@ int ftime_start(void) { if (ftab != NULL) - return(0); + return 0; if ((ftab = (FTM **)calloc(F_TAB_SZ, sizeof(FTM *))) == NULL) { tty_warn(1, "Cannot allocate memory for file time table"); - return(-1); + return -1; } /* @@ -385,11 +385,11 @@ ftime_start(void) if ((ffd = mkstemp(tempfile)) == -1) { syswarn(1, errno, "Unable to create temporary file: %s", tempfile); - return(-1); + return -1; } (void)unlink(tempfile); - return(0); + return 0; } /* @@ -416,7 +416,7 @@ chk_ftime(ARCHD *arcn) * no info, go ahead and add to archive */ if (ftab == NULL) - return(0); + return 0; /* * hash the pathname and look up in table @@ -438,12 +438,12 @@ chk_ftime(ARCHD *arcn) if (lseek(ffd,pt->seek,SEEK_SET) != pt->seek) { syswarn(1, errno, "Failed ftime table seek"); - return(-1); + return -1; } if (xread(ffd, ckname, namelen) != namelen) { syswarn(1, errno, "Failed ftime table read"); - return(-1); + return -1; } /* @@ -468,12 +468,12 @@ chk_ftime(ARCHD *arcn) * file is newer */ pt->mtime = arcn->sb.st_mtime; - return(0); + return 0; } /* * file is older */ - return(1); + return 1; } } @@ -491,7 +491,7 @@ chk_ftime(ARCHD *arcn) pt->namelen = namelen; pt->fow = ftab[indx]; ftab[indx] = pt; - return(0); + return 0; } syswarn(1, errno, "Failed write to file time table"); } else @@ -501,7 +501,7 @@ chk_ftime(ARCHD *arcn) if (pt != NULL) (void)free((char *)pt); - return(-1); + return -1; } /* @@ -527,13 +527,13 @@ int name_start(void) { if (ntab != NULL) - return(0); + return 0; if ((ntab = (NAMT **)calloc(N_TAB_SZ, sizeof(NAMT *))) == NULL) { tty_warn(1, "Cannot allocate memory for interactive rename table"); - return(-1); + return -1; } - return(0); + return 0; } /* @@ -556,7 +556,7 @@ add_name(char *oname, int onamelen, char *nname) * should never happen */ tty_warn(0, "No interactive rename table, links may fail\n"); - return(0); + return 0; } /* @@ -577,14 +577,14 @@ add_name(char *oname, int onamelen, char *nname) * the user just input (if it is different) */ if (strcmp(nname, pt->nname) == 0) - return(0); + return 0; (void)free((char *)pt->nname); if ((pt->nname = strdup(nname)) == NULL) { tty_warn(1, "Cannot update rename table"); - return(-1); + return -1; } - return(0); + return 0; } } @@ -596,14 +596,14 @@ add_name(char *oname, int onamelen, char *nname) if ((pt->nname = strdup(nname)) != NULL) { pt->fow = ntab[indx]; ntab[indx] = pt; - return(0); + return 0; } (void)free((char *)pt->oname); } (void)free((char *)pt); } tty_warn(1, "Interactive rename table out of memory"); - return(-1); + return -1; } /* @@ -700,12 +700,12 @@ int dev_start(void) { if (dtab != NULL) - return(0); + return 0; if ((dtab = (DEVT **)calloc(D_TAB_SZ, sizeof(DEVT *))) == NULL) { tty_warn(1, "Cannot allocate memory for device mapping table"); - return(-1); + return -1; } - return(0); + return 0; } /* @@ -722,8 +722,8 @@ int add_dev(ARCHD *arcn) { if (chk_dev(arcn->sb.st_dev, 1) == NULL) - return(-1); - return(0); + return -1; + return 0; } /* @@ -809,7 +809,7 @@ map_dev(ARCHD *arcn, u_long dev_mask, u_long ino_mask) ino_t nino; if (dtab == NULL) - return(0); + return 0; /* * check for device and inode truncation, and extract the truncated * bit pattern. @@ -840,7 +840,7 @@ map_dev(ARCHD *arcn, u_long dev_mask, u_long ino_mask) */ arcn->sb.st_dev = dpt->dev; arcn->sb.st_ino = nino; - return(0); + return 0; } } else { /* @@ -848,7 +848,7 @@ map_dev(ARCHD *arcn, u_long dev_mask, u_long ino_mask) * form of truncation, we do not need a remap */ if (!trc_ino && !trc_dev) - return(0); + return 0; /* * we have truncation, have to add this as a device to remap @@ -906,14 +906,14 @@ map_dev(ARCHD *arcn, u_long dev_mask, u_long ino_mask) pt->list = dpt; arcn->sb.st_dev = lastdev; arcn->sb.st_ino = nino; - return(0); + return 0; bad: tty_warn(1, "Unable to fix truncated inode/device field when storing %s", arcn->name); tty_warn(0, "Archive may create improper hard links when extracted"); - return(0); + return 0; } /* @@ -944,13 +944,13 @@ int atdir_start(void) { if (atab != NULL) - return(0); + return 0; if ((atab = (ATDIR **)calloc(A_TAB_SZ, sizeof(ATDIR *))) == NULL) { tty_warn(1, "Cannot allocate space for directory access time table"); - return(-1); + return -1; } - return(0); + return 0; } @@ -1062,13 +1062,13 @@ get_atdir(dev_t dev, ino_t ino, time_t *mtime, time_t *atime) u_int indx; if (atab == NULL) - return(-1); + return -1; /* * hash by inode and search the chain for an inode and device match */ indx = ((unsigned)ino) % A_TAB_SZ; if ((pt = atab[indx]) == NULL) - return(-1); + return -1; ppt = &(atab[indx]); while (pt != NULL) { @@ -1085,7 +1085,7 @@ get_atdir(dev_t dev, ino_t ino, time_t *mtime, time_t *atime) * return if we did not find it. */ if (pt == NULL) - return(-1); + return -1; /* * found it. return the times and remove the entry from the table. @@ -1095,7 +1095,7 @@ get_atdir(dev_t dev, ino_t ino, time_t *mtime, time_t *atime) *atime = pt->atime; (void)free((char *)pt->name); (void)free((char *)pt); - return(0); + return 0; } /* @@ -1138,7 +1138,7 @@ dir_start(void) { #ifdef DIRS_USE_FILE if (dirfd != -1) - return(0); + return 0; /* * unlink the file so it goes away at termination by itself @@ -1146,11 +1146,11 @@ dir_start(void) memcpy(tempbase, _TFILE_BASE, sizeof(_TFILE_BASE)); if ((dirfd = mkstemp(tempfile)) >= 0) { (void)unlink(tempfile); - return(0); + return 0; } tty_warn(1, "Unable to create temporary file for directory times: %s", tempfile); - return(-1); + return -1; #else return (0); #endif /* DIRS_USE_FILE */ |