Some of these were overwriting their argument with a pascal

string. Use own Pstring() routine (which uses a static buffer) everywhere.
This commit is contained in:
Jack Jansen 1995-01-18 13:55:41 +00:00
parent 5f653091d1
commit 67132b3de7
4 changed files with 4 additions and 12 deletions

View File

@ -11,11 +11,8 @@ chdir(path)
char *path;
{
WDPBRec pb;
char name[MAXPATH];
strncpy(name, path, sizeof name);
name[MAXPATH-1]= EOS;
pb.ioNamePtr= (StringPtr) c2pstr(name);
pb.ioNamePtr= (StringPtr) Pstring(path);
pb.ioVRefNum= 0;
pb.ioWDDirID= 0;
if (PBHSetVol(&pb, FALSE) != noErr) {

View File

@ -21,10 +21,9 @@ macstat(path, buf)
FileParam f;
HFileInfo hf;
} pb;
char name[256];
short err;
pb.d.ioNamePtr = (unsigned char *)c2pstr(strcpy(name, path));
pb.d.ioNamePtr = (unsigned char *)Pstring(path);
pb.d.ioVRefNum = 0;
pb.d.ioFDirIndex = 0;
pb.d.ioDrDirID = 0;

View File

@ -12,14 +12,12 @@ mkdir(path, mode)
int mode; /* Ignored */
{
HFileParam pb;
char name[MAXPATH];
if (!hfsrunning()) {
errno= ENODEV;
return -1;
}
strncpy(name, path, sizeof name);
pb.ioNamePtr= (StringPtr) c2pstr(name);
pb.ioNamePtr= (StringPtr) Pstring(path);
pb.ioVRefNum= 0;
pb.ioDirID= 0;
if (PBDirCreate((HParmBlkPtr)&pb, FALSE) != noErr) {

View File

@ -9,10 +9,8 @@ rmdir(path)
char *path;
{
IOParam pb;
char name[MAXPATH];
strncpy(name, path, sizeof name);
pb.ioNamePtr= (StringPtr) c2pstr(name);
pb.ioNamePtr= (StringPtr) Pstring(path);
pb.ioVRefNum= 0;
if (PBDelete((ParmBlkPtr)&pb, FALSE) != noErr) {
errno= EACCES;