~ubuntu-branches/ubuntu/saucy/fdclone/saucy-proposed

« back to all changes in this revision

Viewing changes to file.c

  • Committer: Package Import Robot
  • Author(s): Elías Alejandro Año Mendoza
  • Date: 2013-03-31 20:19:19 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20130331201919-vd2f75ssuh1sdctw
Tags: 3.01-1
* New upstream release
* Updated Standard-Version to 3.9.4
* Bump debhelper to 9
* debian/rules enabled hardening build flags

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
#if     !defined (_USEDOSCOPY) && !defined (_NOEXTRACOPY)
89
89
int inheritcopy = 0;
90
90
#endif
91
 
int tmpumask = TMPUMASK;
 
91
short tmpumask = (short)0;
92
92
 
93
93
#ifdef  DEP_PSEUDOPATH
94
94
static int pseudodrv = -1;
281
281
/*ARGSUSED*/
282
282
struct dirent *searchdir(dirp, regexp, arcregstr)
283
283
DIR *dirp;
284
 
CONST reg_t *regexp;
 
284
CONST reg_ex_t *regexp;
285
285
CONST char *arcregstr;
286
286
{
287
287
        struct dirent *dp;
386
386
                }
387
387
                if (!s_isdir(&st)) return(seterrno(ENOTDIR));
388
388
        }
389
 
        entryhist(Xrealpath(dir, tmp, 0), HST_PATH | HST_UNIQ);
 
389
        VOID_C entryhist(Xrealpath(dir, tmp, 0), HST_PATH | HST_UNIQ);
390
390
 
391
391
        return(0);
392
392
}
605
605
        return(lck);
606
606
}
607
607
 
608
 
lockbuf_t *lockfopen(path, type, flags)
 
608
lockbuf_t *lockfopen(path, type, flags, umask)
609
609
CONST char *path, *type;
610
 
int flags;
 
610
int flags, umask;
611
611
{
612
612
        lockbuf_t *lck;
613
613
        XFILE *fp;
614
614
 
615
 
        if (!(lck = lockopen(path, flags, 0666))) return(NULL);
 
615
        if (!(lck = lockopen(path, flags, 0666 & ~umask))) return(NULL);
616
616
 
617
617
        if (!(lck -> flags & LCK_INVALID)) {
618
618
                if (!(fp = Xfdopen(lck -> fd, type))) {
629
629
VOID lockclose(lck)
630
630
lockbuf_t *lck;
631
631
{
632
 
        if (lck) {
633
 
                if (lck -> name) {
634
 
                        VOID_C excllock(lck -> name, LOCK_UN);
635
 
                        Xfree(lck -> name);
636
 
                }
637
 
                if (!(lck -> flags & LCK_INVALID)) {
 
632
        int duperrno;
 
633
 
 
634
        if (!lck) return;
 
635
 
 
636
        duperrno = errno;
 
637
        if (lck -> name) {
 
638
                VOID_C excllock(lck -> name, LOCK_UN);
 
639
                Xfree(lck -> name);
 
640
        }
 
641
        if (!(lck -> flags & LCK_INVALID)) {
638
642
#ifndef NOFLOCK
639
 
                        if (lck -> flags & LCK_FLOCK)
640
 
                                VOID_C fcntllock(lck -> fd, LOCK_UN);
 
643
                if (lck -> flags & LCK_FLOCK)
 
644
                        VOID_C fcntllock(lck -> fd, LOCK_UN);
641
645
#endif
642
 
                        if (lck -> flags & LCK_STREAM)
643
 
                                VOID_C Xfclose(lck -> fp);
644
 
                        else VOID_C Xclose(lck -> fd);
645
 
                }
 
646
                if (lck -> flags & LCK_STREAM)
 
647
                        VOID_C Xfclose(lck -> fp);
 
648
                else VOID_C Xclose(lck -> fd);
 
649
        }
 
650
        errno = duperrno;
646
651
 
647
 
                Xfree(lck);
648
 
        }
 
652
        Xfree(lck);
649
653
}
650
654
 
651
655
int touchfile(path, stp)
912
916
#ifndef NODIRLOOP
913
917
        int issame;
914
918
#endif
 
919
#ifndef _NOEXTRACOPY
 
920
        off_t size;
 
921
#endif
915
922
        char buf[BUFSIZ];
916
923
        off_t total;
917
924
        int n, fd1, fd2, tty, flags, mode, timeout, duperrno;
988
995
                        break;
989
996
                }
990
997
#ifndef _NOEXTRACOPY
991
 
                showprogress(n);
 
998
                size = (off_t)n;
 
999
                showprogress(&size);
992
1000
#endif
993
1001
                if ((n = surewrite(fd2, buf, n)) < 0) break;
994
1002
        }