S/390: Add hwcap value for transactional execution.
[platform/upstream/glibc.git] / misc / getusershell.c
index 636da32..2e8d97e 100644 (file)
@@ -104,7 +104,7 @@ initshells()
        shells = NULL;
        free(strings);
        strings = NULL;
-       if ((fp = fopen(_PATH_SHELLS, "rc")) == NULL)
+       if ((fp = fopen(_PATH_SHELLS, "rce")) == NULL)
                goto init_okshells_noclose;
        if (fstat64(fileno(fp), &statb) == -1) {
        init_okshells:
@@ -116,7 +116,8 @@ initshells()
        }
        if (statb.st_size > ~(size_t)0 / sizeof (char *) * 3)
                goto init_okshells;
-       if ((strings = malloc(statb.st_size + 2)) == NULL)
+       flen = statb.st_size + 3;
+       if ((strings = malloc(flen)) == NULL)
                goto init_okshells;
        shells = malloc(statb.st_size / 3 * sizeof (char *));
        if (shells == NULL) {
@@ -126,7 +127,6 @@ initshells()
        }
        sp = shells;
        cp = strings;
-       flen = statb.st_size + 2;
        while (fgets_unlocked(cp, flen - (cp - strings), fp) != NULL) {
                while (*cp != '#' && *cp != '/' && *cp != '\0')
                        cp++;