English Language flag
// Log In
// CVSweb
Project: FreeWRT
// Summary // Activity // Search // Tracker // Lists // News // SCM // Wiki

SCM Repository

ViewVC logotype

Diff of /trunk/freewrt/tools/paxmirabilis/src/file_subs.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3815 by tg, Sat Feb 17 05:17:30 2007 UTC revision 3816 by tg, Wed Oct 29 17:58:40 2008 UTC
# Line 1  Line 1 
1  /**     $MirOS: src/bin/pax/file_subs.c,v 1.12 2007/02/17 04:52:40 tg Exp $ */  /**     $MirOS: src/bin/pax/file_subs.c,v 1.13 2008/10/29 17:34:48 tg Exp $ */
2  /*      $OpenBSD: file_subs.c,v 1.30 2005/11/09 19:59:06 otto Exp $     */  /*      $OpenBSD: file_subs.c,v 1.30 2005/11/09 19:59:06 otto Exp $     */
3  /*      $NetBSD: file_subs.c,v 1.4 1995/03/21 09:07:18 cgd Exp $        */  /*      $NetBSD: file_subs.c,v 1.4 1995/03/21 09:07:18 cgd Exp $        */
4    
5  /*-  /*-
6   * Copyright (c) 2007 Thorsten Glaser   * Copyright (c) 2007, 2008
7     *      Thorsten Glaser <tg@mirbsd.de>
8   * Copyright (c) 1992 Keith Muller.   * Copyright (c) 1992 Keith Muller.
9   * Copyright (c) 1992, 1993   * Copyright (c) 1992, 1993
10   *      The Regents of the University of California.  All rights reserved.   *      The Regents of the University of California.  All rights reserved.
# Line 55  Line 56 
56  #include "extern.h"  #include "extern.h"
57    
58  __SCCSID("@(#)file_subs.c       8.1 (Berkeley) 5/31/93");  __SCCSID("@(#)file_subs.c       8.1 (Berkeley) 5/31/93");
59  __RCSID("$MirOS: src/bin/pax/file_subs.c,v 1.12 2007/02/17 04:52:40 tg Exp $");  __RCSID("$MirOS: src/bin/pax/file_subs.c,v 1.13 2008/10/29 17:34:48 tg Exp $");
60    
61  #ifndef __GLIBC_PREREQ  #ifndef __GLIBC_PREREQ
62  #define __GLIBC_PREREQ(maj,min) 0  #define __GLIBC_PREREQ(maj,min) 0
# Line 184  file_close(ARCHD *arcn, int fd) Line 185  file_close(ARCHD *arcn, int fd)
185   *      Create a hard link to arcn->ln_name from arcn->name. arcn->ln_name   *      Create a hard link to arcn->ln_name from arcn->name. arcn->ln_name
186   *      must exist;   *      must exist;
187   * Return:   * Return:
188   *      0 if ok, -1 otherwise   *      fd+2 if data should be extracted,
189     *      0 if ok, 1 if we could not make the link, -1 otherwise
190   */   */
191    
192  int  int
193  lnk_creat(ARCHD *arcn)  lnk_creat(ARCHD *arcn, int *fdp)
194  {  {
195          struct stat sb;          struct stat sb;
196            int rv;
197    
198          /*          /*
199           * we may be running as root, so we have to be sure that link target           * we may be running as root, so we have to be sure that link target
# Line 208  lnk_creat(ARCHD *arcn) Line 211  lnk_creat(ARCHD *arcn)
211                  return(-1);                  return(-1);
212          }          }
213    
214          return(mk_link(arcn->ln_name, &sb, arcn->name, 0));          rv = mk_link(arcn->ln_name, &sb, arcn->name, 0);
215            if (fdp != NULL && rv == 0 && sb.st_size == 0 && arcn->skip > 0) {
216                    /* request to write out file data late (broken archive) */
217                    if (pmode)
218                            set_pmode(arcn->name, 0600);
219                    if ((*fdp = open(arcn->name, O_WRONLY | O_TRUNC)) == -1) {
220                            rv = errno;
221                            syswarn(1, rv, "Unable to re-open %s", arcn->name);
222                            if (pmode)
223                                    set_pmode(arcn->name, sb.st_mode);
224                    }
225                    rv = 0;
226            } else if (fdp != NULL)
227                    *fdp = -1;
228            return (rv);
229  }  }
230    
231  /*  /*

Legend:
Removed from v.3815  
changed lines
  Added in v.3816

root@freewrt.org:443
ViewVC Help
Powered by ViewVC 1.1.20