Kaydet (Commit) 67132b3d authored tarafından Jack Jansen's avatar Jack Jansen

Some of these were overwriting their argument with a pascal

string. Use own Pstring() routine (which uses a static buffer) everywhere.
üst 5f653091
...@@ -11,11 +11,8 @@ chdir(path) ...@@ -11,11 +11,8 @@ chdir(path)
char *path; char *path;
{ {
WDPBRec pb; WDPBRec pb;
char name[MAXPATH];
strncpy(name, path, sizeof name); pb.ioNamePtr= (StringPtr) Pstring(path);
name[MAXPATH-1]= EOS;
pb.ioNamePtr= (StringPtr) c2pstr(name);
pb.ioVRefNum= 0; pb.ioVRefNum= 0;
pb.ioWDDirID= 0; pb.ioWDDirID= 0;
if (PBHSetVol(&pb, FALSE) != noErr) { if (PBHSetVol(&pb, FALSE) != noErr) {
......
...@@ -21,10 +21,9 @@ macstat(path, buf) ...@@ -21,10 +21,9 @@ macstat(path, buf)
FileParam f; FileParam f;
HFileInfo hf; HFileInfo hf;
} pb; } pb;
char name[256];
short err; short err;
pb.d.ioNamePtr = (unsigned char *)c2pstr(strcpy(name, path)); pb.d.ioNamePtr = (unsigned char *)Pstring(path);
pb.d.ioVRefNum = 0; pb.d.ioVRefNum = 0;
pb.d.ioFDirIndex = 0; pb.d.ioFDirIndex = 0;
pb.d.ioDrDirID = 0; pb.d.ioDrDirID = 0;
......
...@@ -12,14 +12,12 @@ mkdir(path, mode) ...@@ -12,14 +12,12 @@ mkdir(path, mode)
int mode; /* Ignored */ int mode; /* Ignored */
{ {
HFileParam pb; HFileParam pb;
char name[MAXPATH];
if (!hfsrunning()) { if (!hfsrunning()) {
errno= ENODEV; errno= ENODEV;
return -1; return -1;
} }
strncpy(name, path, sizeof name); pb.ioNamePtr= (StringPtr) Pstring(path);
pb.ioNamePtr= (StringPtr) c2pstr(name);
pb.ioVRefNum= 0; pb.ioVRefNum= 0;
pb.ioDirID= 0; pb.ioDirID= 0;
if (PBDirCreate((HParmBlkPtr)&pb, FALSE) != noErr) { if (PBDirCreate((HParmBlkPtr)&pb, FALSE) != noErr) {
......
...@@ -9,10 +9,8 @@ rmdir(path) ...@@ -9,10 +9,8 @@ rmdir(path)
char *path; char *path;
{ {
IOParam pb; IOParam pb;
char name[MAXPATH];
strncpy(name, path, sizeof name); pb.ioNamePtr= (StringPtr) Pstring(path);
pb.ioNamePtr= (StringPtr) c2pstr(name);
pb.ioVRefNum= 0; pb.ioVRefNum= 0;
if (PBDelete((ParmBlkPtr)&pb, FALSE) != noErr) { if (PBDelete((ParmBlkPtr)&pb, FALSE) != noErr) {
errno= EACCES; errno= EACCES;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment