summaryrefslogtreecommitdiff
path: root/utils/lndir
diff options
context:
space:
mode:
authorTamar Christina <tamar@zhox.com>2018-03-29 14:22:09 +0100
committerTamar Christina <tamar@zhox.com>2018-03-31 10:11:53 +0100
commit4de585a5c1ac3edc2914cebcac1753b514051a89 (patch)
tree09bfb4251808007bb4ad79c6f10f3e4fbe3e9312 /utils/lndir
parentafb686a88901d7d0c93627806d7e4d0444aa17e8 (diff)
downloadhaskell-4de585a5c1ac3edc2914cebcac1753b514051a89.tar.gz
Remove MAX_PATH restrictions from RTS, I/O manager and various utilities
Summary: This shims out fopen and sopen so that they use modern APIs under the hood along with namespaced paths. This lifts the MAX_PATH restrictions from Haskell programs and makes the new limit ~32k. There are only some slight caveats that have been documented. Some utilities have not been upgraded such as lndir, since all these things are different cabal packages I have been forced to copy the source in different places which is less than ideal. But it's the only way to keep sdist working. Test Plan: ./validate Reviewers: hvr, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie, carter GHC Trac Issues: #10822 Differential Revision: https://phabricator.haskell.org/D4416
Diffstat (limited to 'utils/lndir')
-rw-r--r--utils/lndir/lndir.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/utils/lndir/lndir.c b/utils/lndir/lndir.c
index 87f2824166..8ea5ab2ab4 100644
--- a/utils/lndir/lndir.c
+++ b/utils/lndir/lndir.c
@@ -2,7 +2,7 @@
/* Create shadow link tree (after X11R4 script of the same name)
Mark Reinhold (mbr@lcs.mit.edu)/3 January 1990 */
-/*
+/*
Copyright (c) 1990, X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -46,6 +46,7 @@ in this Software without prior written authorization from the X Consortium.
#define NeedVarargsPrototypes 1
#include "lndir-Xos.h"
+#include "fs.h"
#include <stdlib.h>
#include <stdio.h>
#include <sys/stat.h>
@@ -182,11 +183,11 @@ int copyfile(const char *oldpath, const char *newpath) {
return symlink(oldpath, newpath);
} else {
#endif
- f_old = fopen(oldpath, "rb");
+ f_old = __hs_fopen(oldpath, "rb");
if (f_old == NULL) {
return -1;
}
- f_new = fopen(newpath, "wbx");
+ f_new = __hs_fopen(newpath, "wbx");
if (f_new == NULL) {
e = errno;
fclose(f_old);
@@ -272,7 +273,7 @@ int rel; /* if true, prepend "../" to fn before using */
else
buf[0] = '\0';
strcat (buf, fn);
-
+
if (!(df = opendir (buf))) {
msg ("%s: Cannot opendir", buf);
return 1;
@@ -305,7 +306,7 @@ int rel; /* if true, prepend "../" to fn before using */
#if defined(S_ISDIR)
if(S_ISDIR(sb.st_mode))
#else
- if (sb.st_mode & S_IFDIR)
+ if (sb.st_mode & S_IFDIR)
#endif
{
/* directory */
@@ -397,7 +398,7 @@ int rel; /* if true, prepend "../" to fn before using */
mperror (dp->d_name);
}
}
-
+
closedir (df);
return 0;
}
@@ -410,7 +411,7 @@ char **av;
char* tn;
struct stat fs, ts;
#if defined(__CYGWIN32__)
- /*
+ /*
The lndir code assumes unix-style paths to work. cygwin
lets you get away with using dos'ish paths (e.g., "f:/oo")
in most contexts. Using them with 'lndir' will seriously
@@ -457,7 +458,7 @@ char **av;
if (stat (tn, &ts) < 0) {
if (force && (tn[0] != '.' || tn[1] != '\0') ) {
mymkdir(tn, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH );
- }
+ }
else {
quiterr (1, tn);
#if defined(S_ISDIR)