~ubuntu-branches/ubuntu/precise/util-linux/precise-proposed

« back to all changes in this revision

Viewing changes to sys-utils/readprofile.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2011-06-20 22:31:50 UTC
  • mfrom: (1.6.3 upstream) (4.5.1 sid)
  • Revision ID: james.westby@ubuntu.com-20110620223150-lz8wrv0946ihcz3z
Tags: 2.19.1-2ubuntu1
* Merge from Debian unstable, remaining changes:
  - Build for multiarch.
  - Add pre-depends on multiarch-support.
  - configure.ac: don't try to be clever about extracting a path name from
    $libdir to append to /usr in a way that's not overridable; instead,
    reuse the built-in configurable libexecdir.
  - Fix up the .pc.in files to know about libexecdir, so our substitutions
    don't leave us with unusable pkg-config files.
  - Install custom blkid.conf to use /dev/.blkid.tab since we don't
    expect device names to survive a reboot
  - Mention mountall(8) in fstab(5) manpages, along with its special
    options.
  - Since upstart is required in Ubuntu, the hwclock.sh init script is not
    called on startup and the hwclockfirst.sh init script is removed.
  - Drop depends on initscripts for the above.
  - Replace hwclock udev rule with an Upstart job.
  - For the case where mount is called with a directory to mount, look
    that directory up in mountall's /lib/init/fstab if we couldn't find
    it mentioned anywhere else.  This means "mount /proc", "mount /sys",
    etc. work.
  - mount.8 points to the cifs-utils package, not the obsolete smbfs one. 
* Dropped changes:
  - mount.preinst: lsb_release has been fixed in lucid and above to be
    usable without configuration, so we don't have to diverge from Debian
    here anymore.
* Changes merged upstream:
  - sfdisk support for '+' with '-N'
  - mount/umount.c: fix a segfault on umount with empty mtab entry
  - Fix arbitrary unmount with fuse security issue

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
#include <sys/types.h>
50
50
#include <sys/stat.h>
51
51
#include <sys/utsname.h>
 
52
 
 
53
#include "xalloc.h"
52
54
#include "nls.h"
53
55
 
54
56
#define S_LEN 128
60
62
static char defaultpro[]="/proc/profile";
61
63
static char optstring[]="M:m:np:itvarVbs";
62
64
 
63
 
static void *
64
 
xmalloc (size_t size) {
65
 
        void *t;
66
 
 
67
 
        if (size == 0)
68
 
                return NULL;
69
 
 
70
 
        t = malloc (size);
71
 
        if (t == NULL) {
72
 
                fprintf(stderr, _("out of memory"));
73
 
                exit(1);
74
 
        }
75
 
 
76
 
        return t;
77
 
}
78
 
 
79
65
static FILE *
80
66
myopen(char *name, char *mode, int *flag) {
81
67
        int len = strlen(name);
242
228
                exit(1);
243
229
        }
244
230
 
245
 
        if (!(buf=malloc(len))) {
246
 
                fprintf(stderr,"%s: malloc(): %s\n", prgname, strerror(errno));
247
 
                exit(1);
248
 
        }
 
231
        buf = xmalloc(len);
249
232
 
250
233
        if (read(proFd,buf,len) != len) {
251
234
                fprintf(stderr,"%s: %s: %s\n",prgname,proFile,strerror(errno));
340
323
                        done = 1;
341
324
                else {
342
325
                        /* ignore any LEADING (before a '[tT]' symbol is found)
343
 
                           Absolute symbols */
344
 
                        if ((*mode == 'A' || *mode == '?') && total == 0)
 
326
                           Absolute symbols and __init_end because some
 
327
                           architectures place it before .text section */
 
328
                        if ((*mode == 'A' || *mode == '?')
 
329
                            && (total == 0 || !strcmp(next_name, "__init_end")))
345
330
                                continue;
346
331
                        if (*mode != 'T' && *mode != 't' &&
347
332
                            *mode != 'W' && *mode != 'w')