- {
- /* Trailing NUL will overwrite the trailing slash. */
- char *short_name = malloc (len);
- if (!short_name)
- {
- errno = EPERM;
- return -1;
- }
- memcpy (short_name, name, len);
- while (len && ISSLASH (short_name[len - 1]))
- short_name[--len] = '\0';
- if (len && (lstatat (fd, short_name, &st) || S_ISLNK (st.st_mode)))
- {
- free (short_name);
- errno = EPERM;
- return -1;
- }
- free (short_name);
- }
+ {
+ /* Trailing NUL will overwrite the trailing slash. */
+ char *short_name = malloc (len);
+ if (!short_name)
+ {
+ errno = EPERM;
+ return -1;
+ }
+ memcpy (short_name, name, len);
+ while (len && ISSLASH (short_name[len - 1]))
+ short_name[--len] = '\0';
+ if (len && (lstatat (fd, short_name, &st) || S_ISLNK (st.st_mode)))
+ {
+ free (short_name);
+ errno = EPERM;
+ return -1;
+ }
+ free (short_name);
+ }