]> git.pld-linux.org Git - projects/setup.git/commitdiff
- test return values
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Sat, 21 Feb 2009 18:26:15 +0000 (18:26 +0000)
committerArkadiusz Miśkiewicz <arekm@maven.pl>
Sat, 21 Feb 2009 18:26:15 +0000 (18:26 +0000)
Changed files:
    joinpasswd.c -> 1.10

joinpasswd.c

index 75fb9ebcd7bede96398b32378beefb61a1c5e5c1..c96ff0d5d021950eaadc42ebfde05cddb260b74c 100644 (file)
@@ -102,7 +102,8 @@ char *map_file(const char *name, int *sz)
        fd = open(name, O_RDONLY);
        if (fd == -1)
                return NULL;
-       fstat(fd, &st);
+       if (fstat(fd, &st) < 0)
+               return NULL;
        *sz = st.st_size;
        ptr = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
        if (ptr == MAP_FAILED)
@@ -282,6 +283,8 @@ int join(const char *old_name, const char *new_name, const char *backup_name)
 #endif /* SILENT */
 
        fd = open(old_name, O_WRONLY|O_APPEND);
+       if (fd < 0)
+               fatal("cannot open old file");
        
        for (i = 0; i < new_sz; ) {
                id = new + i;
This page took 0.034747 seconds and 4 git commands to generate.