History log of /freebsd/lib/libc/gen/getcwd.c (Results 76 – 88 of 88)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 9c2d6fcf 15-Sep-1997 Poul-Henning Kamp <phk@FreeBSD.org>

Fix a buglet and a couple of stylistic nits from Bruce.


# 27262cac 14-Sep-1997 Poul-Henning Kamp <phk@FreeBSD.org>

Add __getcwd() syscall, and have getcwd() take a shot at it.
If your kernel doesn't support __getcwd() or if __getcwd() cannot
deliver because of cache expiry, it does the canonical thing.


# f5f31fba 15-Aug-1997 David Greenman <dg@FreeBSD.org>

Fixed file descriptor leak that occurs after certain types of failures.

PR: 3516
Submitted by: Matthew Flatt <mflatt@cs.rice.edu>


Revision tags: release/2.2.2_cvs, release/2.2.1_cvs, release/2.2.0
# 098f04f5 13-Mar-1997 Peter Wemm <peter@FreeBSD.org>

Back out a dubious Lite2 change to "optimise" getcwd() to look at $PWD
because it's potentially dangerous (think: symlink races). Move
realpath() back to it's original location, and remove getcwd_ph

Back out a dubious Lite2 change to "optimise" getcwd() to look at $PWD
because it's potentially dangerous (think: symlink races). Move
realpath() back to it's original location, and remove getcwd_physical()
by renaming it back to getcwd() and zapping the original getcwd wrapper.

Noticed by: bde

show more ...


# 9dc11641 11-Mar-1997 Peter Wemm <peter@FreeBSD.org>

merge from Lite2 - realpath() now shares a lot of code with getcwd()
and is now in the same file.


# 662909a7 11-Mar-1997 Peter Wemm <peter@FreeBSD.org>

Import CSRG 4.4BSD-Lite2 lib/libc onto vendor branch


Revision tags: release/2.1.7_cvs, release/2.1.6_cvs, release/2.1.6.1
# 0d4453d3 17-Oct-1996 Peter Wemm <peter@FreeBSD.org>

Corrently null-terminate the path being passed to the opendir() calls,
malloc() does is not defined to return a zeroed buffer leading to
"strange" problems.

Submitted by: Karl Denninger <karl@mcs.co

Corrently null-terminate the path being passed to the opendir() calls,
malloc() does is not defined to return a zeroed buffer leading to
"strange" problems.

Submitted by: Karl Denninger <karl@mcs.com>, PR#1826

show more ...


Revision tags: release/2.1.5_cvs
# 51295a4d 12-Jul-1996 Jordan K. Hubbard <jkh@FreeBSD.org>

General -Wall warning cleanup, part I.
Submitted-By: Kent Vander Velden <graphix@iastate.edu>


Revision tags: release/2.1.0_cvs
# e78bad23 20-Jun-1995 Jeffrey Hsu <hsu@FreeBSD.org>

Don't cast void functions to void.
Obtained from: NetBSD commit by jtc on June 16, 1995.


Revision tags: release/2.0.5_cvs
# 16be3810 07-Feb-1995 David Greenman <dg@FreeBSD.org>

Backed out Keith Bostic's getcwd/$PWD hack. It is causing things to break
all over the place.


# 03cfe806 04-Feb-1995 Poul-Henning Kamp <phk@FreeBSD.org>

A cute hack to speed up things by Keith: if getenv("PWD") is the same
inode as ".", then just return that. I added a check so it must start with
a '/'.

Reviewed by: phk
Submitted by: bostic@cs.ber

A cute hack to speed up things by Keith: if getenv("PWD") is the same
inode as ".", then just return that. I added a check so it must start with
a '/'.

Reviewed by: phk
Submitted by: bostic@cs.berkeley.edu (Keith Bostic)

show more ...


# b01f0b7d 12-Dec-1994 Bruce Evans <bde@FreeBSD.org>

Obtained from: 1.1.5

getcwd() has two off-by-one bugs in FreeBSD-2.0:

1. getcwd(buf, size) fails when the size is just large enough.
2. getcwd(buf + 1, 1) incorrectly succeeds when the current dire

Obtained from: 1.1.5

getcwd() has two off-by-one bugs in FreeBSD-2.0:

1. getcwd(buf, size) fails when the size is just large enough.
2. getcwd(buf + 1, 1) incorrectly succeeds when the current directory
is "/". buf[0] and buf[2] are clobbered.

(I modified Bruce's original patch to return the proper error code
[ERANGE] in the case of #2, but otherwise... -DG)

This program demonstrates the bug:

---
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>

int main(void)
{
char buf[5];
int errors;

errors = 0;
if (chdir("/tmp") != 0) {
perror("chdir");
abort();
}
if (getcwd(buf, 5) == NULL) {
perror("oops, getcwd failed for buffer size = size required");
++errors;
}
if (chdir("/") != 0) {
perror("chdir");
abort();
}
buf[0] = 0;
buf[2] = 1;
if (getcwd(buf + 1, 1) != NULL) {
fprintf(stderr,
"oops, getcwd succeeded for buffer size = one too small\n");
++errors;
}
if (buf[0] != 0) {
fprintf(stderr,
"oops, getcwd scribbled on memory before start of buffer\n");
++errors;
}
if (buf[2] != 1) {
fprintf(stderr,
"oops, getcwd scribbled on memory after end of buffer\n");
++errors;
}
exit(errors == 0 ? 0 : 1);
}

show more ...


Revision tags: release/2.0, release/1.1.5.1_cvs
# 58f0484f 27-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite Lib Sources


1234