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

« back to all changes in this revision

Viewing changes to .pc/01_previous_changes.patch/dosdisk.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:
20
20
#include <sys/timeb.h>
21
21
#endif
22
22
#ifdef  LINUX
23
 
#include <mntent.h>
 
23
#include "mntinfo.h"
24
24
#include <sys/mount.h>
25
25
#include <linux/unistd.h>
26
26
# ifndef        BLKFLSBUF
66
66
#define D_SECSIZE(dl)           (dl).d_secsize
67
67
#endif
68
68
 
69
 
#ifndef MOUNTED
70
 
#define MOUNTED                 "/etc/mtab"
71
 
#endif
72
 
 
73
69
#if     defined (USELLSEEK) && !defined (_syscall5)
74
 
#define _llseek(f,h,l,r,w)      syscall(SYS__llseek, f, h, l, r, w)
75
 
#endif
 
70
# if    defined (__NR__llseek) && !defined (SYS__llseek)
 
71
# define        SYS__llseek     __NR__llseek
 
72
# endif
 
73
# ifdef SYS__llseek
 
74
# define        _llseek(f, h, l, r, w) \
 
75
                                syscall(SYS__llseek, f, h, l, r, w)
 
76
# endif
 
77
#endif  /* USELLSEEK && !_syscall5 */
76
78
 
77
79
#define KC_SJIS1                0001
78
80
#define KC_SJIS2                0002
147
149
static int NEAR _readbpb __P_((devstat *, CONST bpb_t *));
148
150
#endif
149
151
static int NEAR readbpb __P_((devstat *, int));
150
 
#ifdef  HDDMOUNT
 
152
#if     defined (HDDMOUNT) && defined (DIOCGDINFO)
151
153
static l_off_t *NEAR _readpt __P_((l_off_t, l_off_t, int, int, int, int));
152
154
#endif
153
155
static int NEAR _dosopendev __P_((int));
1418
1420
#endif
1419
1421
#ifdef  LINUX
1420
1422
        struct stat st1, st2;
1421
 
        struct mntent *mntp;
 
1423
        mnt_t *mntp, mnt;
1422
1424
        FILE *fp;
1423
1425
#endif
1424
1426
        CONST bpb_t *bpb;
1467
1469
                }
1468
1470
# endif
1469
1471
# ifdef LINUX
1470
 
                if (i == (O_BINARY | O_RDWR)) {
1471
 
                        if (stat(devp -> ch_name, &st1)) {
1472
 
                                doserrno = errno;
1473
 
                                errno = duperrno;
1474
 
                                return(-1);
1475
 
                        }
1476
 
                        if ((fp = setmntent(MOUNTED, "r"))) {
1477
 
                                while ((mntp = getmntent(fp))) {
 
1472
                if (i != (O_BINARY | O_RDWR)) /*EMPTY*/;
 
1473
                else if (stat(devp -> ch_name, &st1) < 0) {
 
1474
                        doserrno = errno;
 
1475
                        errno = duperrno;
 
1476
                        return(-1);
 
1477
                }
 
1478
                else if ((fp = Xsetmntent(MOUNTED, "r"))) {
 
1479
#  ifdef        FAKEUNINIT
 
1480
                        mntp = &mnt;
 
1481
#  endif
 
1482
                        while ((mntp = Xgetmntent(fp, &mnt))) {
1478
1483
#  if   1
1479
 
                                        if (strstr(mntp -> mnt_opts, "ro"))
1480
 
                                                continue;
 
1484
                                if (Xhasmntopt(mntp, "ro")) continue;
1481
1485
#  endif
1482
 
                                        if (stat(mntp -> mnt_fsname, &st2))
1483
 
                                                continue;
1484
 
                                        if (st1.st_ino == st2.st_ino) {
1485
 
                                                i = (O_BINARY | O_RDONLY);
1486
 
                                                devp -> flags |= F_RONLY;
1487
 
                                                break;
1488
 
                                        }
 
1486
                                if (stat(mntp -> Xmnt_fsname, &st2) < 0)
 
1487
                                        continue;
 
1488
                                if (st1.st_ino == st2.st_ino) {
 
1489
                                        i = (O_BINARY | O_RDONLY);
 
1490
                                        devp -> flags |= F_RONLY;
 
1491
                                        break;
1489
1492
                                }
1490
 
                                endmntent(fp);
1491
1493
                        }
 
1494
                        Xendmntent(fp);
1492
1495
                }
1493
1496
# endif /* LINUX */
1494
1497
                if ((fd = open(devp -> ch_name, i, 0666)) < 0) {
1652
1655
#endif  /* !MSDOS */
1653
1656
 
1654
1657
#ifdef  HDDMOUNT
 
1658
# ifdef DIOCGDINFO
1655
1659
static l_off_t *NEAR _readpt(offset, extoffset, fd, head, sect, secsiz)
1656
1660
l_off_t offset, extoffset;
1657
1661
int fd, head, sect, secsiz;
1711
1715
                        pt = (partition_t *)cp;
1712
1716
                        ofs = byte2dword(pt -> f_sect);
1713
1717
                        ofs *= secsiz;
1714
 
                        if (pt -> filesys == PT_EXTEND
1715
 
                        || pt -> filesys == PT_EXTENDLBA) {
 
1718
                        if (pt -> filesys == PTAT_EXTEND
 
1719
                        || pt -> filesys == PTAT_EXTENDLBA) {
1716
1720
                                if (extoffset) ofs += extoffset;
1717
1721
                                else extoffset = ofs;
1718
1722
 
1743
1747
                                free(sp);
1744
1748
                                continue;
1745
1749
                        }
1746
 
                        else if (pt -> filesys != PT_FAT12
1747
 
                        && pt -> filesys != PT_FAT16
1748
 
                        && pt -> filesys != PT_FAT16X
1749
 
                        && pt -> filesys != PT_FAT32
1750
 
                        && pt -> filesys != PT_FAT32LBA
1751
 
                        && pt -> filesys != PT_FAT16XLBA)
 
1750
                        else if (pt -> filesys != PTAT_FAT12
 
1751
                        && pt -> filesys != PTAT_FAT16
 
1752
                        && pt -> filesys != PTAT_FAT16X
 
1753
                        && pt -> filesys != PTAT_FAT32
 
1754
                        && pt -> filesys != PTAT_FAT32LBA
 
1755
                        && pt -> filesys != PTAT_FAT16XLBA)
1752
1756
                                continue;
1753
1757
 
1754
1758
                        ofs += offset;
1768
1772
 
1769
1773
        return(slice);
1770
1774
}
 
1775
# endif /* DIOCGDINFO */
1771
1776
 
1772
1777
l_off_t *readpt(devfile, pc98)
1773
1778
CONST char *devfile;