Parent Directory
|
Revision Log
Remove the SB_STATIC and including of getcwd.c, etc voodoo, as we new use a symbol map, and all non-exported symbols are local. Cleanup getcwd.c, as the generic getcwd for older 2.4 kernels do not work properly anyhow, and just makes things slower. Some other warning fixes.
| 1 | /* These functions find the absolute path to the current working directory. */ |
| 2 | |
| 3 | #include <errno.h> |
| 4 | #include <stdio.h> |
| 5 | #include <stdlib.h> |
| 6 | #include <sys/param.h> |
| 7 | #include <sys/types.h> |
| 8 | #include <sys/stat.h> |
| 9 | #include <unistd.h> |
| 10 | |
| 11 | #include "config.h" |
| 12 | #include "localdecls.h" |
| 13 | |
| 14 | #ifndef __set_errno |
| 15 | # define __set_errno(val) errno = (val) |
| 16 | #endif |
| 17 | |
| 18 | char *egetcwd(char *buf, size_t size) |
| 19 | { |
| 20 | struct stat st; |
| 21 | char *tmpbuf; |
| 22 | |
| 23 | __set_errno(0); |
| 24 | tmpbuf = getcwd(buf, size); |
| 25 | if (tmpbuf) |
| 26 | lstat(buf, &st); |
| 27 | |
| 28 | if ((tmpbuf) && (errno == ENOENT)) { |
| 29 | /* If lstat() failed with eerror = ENOENT, then its |
| 30 | * possible that we are running on an older kernel |
| 31 | * which had issues with returning invalid paths if |
| 32 | * they got too long. |
| 33 | */ |
| 34 | free(tmpbuf); |
| 35 | |
| 36 | return NULL; |
| 37 | } |
| 38 | |
| 39 | return tmpbuf; |
| 40 | } |
| 41 |
| Name | Value |
|---|---|
| svn:eol-style | native |
| svn:keywords | Author Date Id Revision |
| ViewVC Help | |
| Powered by ViewVC 1.1.13 |