🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #1036

Why does getpwd() have to chdir()?

#1036
From: Joe Wells
Date: Tue, 16 Oct 1990 21:54
12 lines
1094 bytes
In article <3554@skye.ed.ac.uk> richard@aiai.ed.ac.uk (Richard Tobin) writes:

   Why does getpwd() have to chdir()?

In most Unixes, there's a kernel limit of 1024 characters in a pathname.
If your current directory were located deep enough in the filesystem,
getcwd() couldn't make it all the way up to the root without chdir()-ing.
Of course, you understand how unlikely this is, but it is necessary for
the algorithm to be correct.

-- 
Joe Wells <jbw@bu.edu>
Technical Details
Message-ID: <JBW.90Oct16175441@bucsf.bu.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!uunet!bu.edu!nntp-read!jbw
References: <1977@sixhub.UUCP> <1990Oct7.001518.14216@diku.dk> <1990Oct11.012643.11274@diku.dk> <11478@alice.att.com> <3554@skye.ed.ac.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!uunet!bu.edu!nntp-read!jbw
From: jbw@bucsf.bu.edu (Joe Wells)
Newsgroups: comp.unix.programmer
Subject: Why does getpwd() have to chdir()?
Message-ID: <JBW.90Oct16175441@bucsf.bu.edu>
Date: 16 Oct 90 21:54:41 GMT
References: <1977@sixhub.UUCP> <1990Oct7.001518.14216@diku.dk>
 <1990Oct11.012643.11274@diku.dk> <11478@alice.att.com>
 <3554@skye.ed.ac.uk>
Sender: news@bu.edu.bu.edu
Organization: Boston University Computer Science Department
Lines: 12
In-reply-to: richard@aiai.ed.ac.uk's message of 15 Oct 90 17:30:09 GMT