Deleted Added
full compact
getcwd.c (235647) getcwd.c (241046)
1/*
2 * Copyright (c) 1989, 1991, 1993, 1995
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#if defined(LIBC_SCCS) && !defined(lint)
31static char sccsid[] = "@(#)getcwd.c 8.5 (Berkeley) 2/7/95";
32#endif /* LIBC_SCCS and not lint */
33#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1989, 1991, 1993, 1995
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#if defined(LIBC_SCCS) && !defined(lint)
31static char sccsid[] = "@(#)getcwd.c 8.5 (Berkeley) 2/7/95";
32#endif /* LIBC_SCCS and not lint */
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/lib/libc/gen/getcwd.c 235647 2012-05-19 12:44:27Z gleb $");
34__FBSDID("$FreeBSD: head/lib/libc/gen/getcwd.c 241046 2012-09-29 11:54:34Z jilles $");
35
36#include "namespace.h"
37#include <sys/param.h>
38#include <sys/stat.h>
39
40#include <dirent.h>
41#include <errno.h>
42#include <fcntl.h>

--- 94 unchanged lines hidden (view full) ---

137 bcopy(bpt, pt, ept - bpt);
138 if (dir)
139 (void) closedir(dir);
140 return (pt);
141 }
142
143 /* Open and stat parent directory. */
144 fd = _openat(dir != NULL ? _dirfd(dir) : AT_FDCWD,
35
36#include "namespace.h"
37#include <sys/param.h>
38#include <sys/stat.h>
39
40#include <dirent.h>
41#include <errno.h>
42#include <fcntl.h>

--- 94 unchanged lines hidden (view full) ---

137 bcopy(bpt, pt, ept - bpt);
138 if (dir)
139 (void) closedir(dir);
140 return (pt);
141 }
142
143 /* Open and stat parent directory. */
144 fd = _openat(dir != NULL ? _dirfd(dir) : AT_FDCWD,
145 "..", O_RDONLY);
145 "..", O_RDONLY | O_CLOEXEC);
146 if (fd == -1)
147 goto err;
148 if (dir)
149 (void) closedir(dir);
150 if (!(dir = fdopendir(fd)) || _fstat(_dirfd(dir), &s)) {
151 _close(fd);
152 goto err;
153 }

--- 79 unchanged lines hidden ---
146 if (fd == -1)
147 goto err;
148 if (dir)
149 (void) closedir(dir);
150 if (!(dir = fdopendir(fd)) || _fstat(_dirfd(dir), &s)) {
151 _close(fd);
152 goto err;
153 }

--- 79 unchanged lines hidden ---