~ubuntu-branches/debian/stretch/uswsusp/stretch

« back to all changes in this revision

Viewing changes to swap-offset.c

  • Committer: Bazaar Package Importer
  • Author(s): Rodolfo García Peñas (kix), Rodolfo García Peñas (kix), Closes: #552484, #576803, #528483, Closes: #495111, #595125, #486352, #433872, #590233, Closes: #550725, #549118, Closes: #437094, #586674, #547158, #567604, Closes: #520705, Anibal Monsalve Salazar
  • Date: 2011-03-14 08:26:16 UTC
  • mfrom: (0.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110314082616-7mjcl6tfzsv22arm
Tags: 1.0-1
[ Rodolfo García Peñas (kix) ]
* New 1.0 version [Closes: #589743, #578496, #617534]
* A lot of new machines. 
  [Closes: #552484, #576803, #528483] 
  [Closes: #495111, #595125, #486352, #433872, #590233] 
* A new length for addressing 
  [Closes: #550725, #549118]
  (http://lkml.org/lkml/2009/11/3/377)
* Support for Kernel Mode Set (KMS) 
  [Closes: #437094, #586674, #547158, #567604]
* Switch to dpkg-source 3.0 (quilt) format
* Compiled without splash support. 
  libsplash is not included in stable, many bugs.
* Moved the manpage file "suspend.conf.8" to manual section 5.
  [Closes: #520705]

[ Anibal Monsalve Salazar ]
* Update uploaders list

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
        unsigned int offset;
30
30
        int size, blk_size;
31
31
        int fd;
32
 
        int i;
 
32
        unsigned int i;
 
33
        ssize_t ret;
33
34
        struct stat stat;
34
35
        unsigned char buf[SWAP_SIG_SIZE];
35
36
        int err = 0;
46
47
                perror("open()");
47
48
                return err;
48
49
        }
 
50
        if (fstat(fd, &stat)) {
 
51
                err = errno;
 
52
                perror("fstat()");
 
53
                goto out;
 
54
        }
 
55
        if (!S_ISREG(stat.st_mode)) {
 
56
                fprintf(stderr, "Not a regular file\n");
 
57
                err = EINVAL;
 
58
                goto out;
 
59
        }
49
60
 
50
61
        /* Check swap signature */
51
62
        if (lseek(fd, page_size - SWAP_SIG_SIZE, SEEK_SET) < 0) {
53
64
                perror("lseek()");
54
65
                goto out;
55
66
        }
56
 
        i = read(fd, buf, SWAP_SIG_SIZE);
57
 
        if (i < 0) {
 
67
        ret = read(fd, buf, SWAP_SIG_SIZE);
 
68
        if (ret < 0) {
58
69
                err = errno;
59
70
                perror("read()");
60
71
                goto out;
61
 
        } else if (i < SWAP_SIG_SIZE) {
 
72
        } else if (ret < SWAP_SIG_SIZE) {
62
73
                fprintf(stderr, "Failed to read swap signature: file is too short.\n");
63
74
                err = EINVAL;
64
75
                goto out;
70
81
                goto out;
71
82
        }
72
83
 
73
 
        if (fstat(fd, &stat)) {
74
 
                err = errno;
75
 
                perror("fstat()");
76
 
                goto out;
77
 
        }
78
84
        if (ioctl(fd, FIGETBSZ, &blk_size)) {
79
85
                err = errno;
80
86
                perror("ioctl(FIGETBSZ) failed");