Skip to content

Commit

Permalink
Merge pull request #330 from akgrant43/FapSessionId
Browse files Browse the repository at this point in the history
FileAttributesPlugin 2.0.8
  • Loading branch information
nicolas-cellier-aka-nice committed Dec 30, 2018
2 parents 8b7e29e + 59d585b commit 7b4dedb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 25 deletions.
8 changes: 5 additions & 3 deletions platforms/Cross/plugins/FileAttributesPlugin/faCommon.h
Expand Up @@ -8,16 +8,18 @@
#include "faSupport.h"

/*
* fapathptr
* FAPathPtr
*
* fapathptr is used to pass a pointer to the faPath between the VM and image.
* FAPathPtr is used to pass a pointer to the faPath between the VM and image.
* It holds the current VM session ID to prevent stale pointers being used
* across VM restarts.
*
* The definition here has to be kept in sync with the VMMaker version.
*/
typedef struct fapathptrstruct {
int sessionId;
fapath *faPath;
} fapathptr;
} FAPathPtr;


sqInt faInitialiseModule();
Expand Down
44 changes: 22 additions & 22 deletions src/plugins/FileAttributesPlugin/FileAttributesPlugin.c
@@ -1,9 +1,9 @@
/* Automatically generated by
VMPluginCodeGenerator VMMaker.oscog-eem.2504 uuid: a00b0fad-c04c-47a6-8a11-5dbff110ac11
from
FileAttributesPlugin FileAttributesPlugin.oscog-akg.47 uuid: 352a23fa-7521-49aa-8801-e32b80394b9d
FileAttributesPlugin FileAttributesPlugin.oscog-akg.49 uuid: 00b4eed5-b2a8-454a-90b7-c3662d7c5423
*/
static char __buildInfo[] = "FileAttributesPlugin FileAttributesPlugin.oscog-akg.47 uuid: 352a23fa-7521-49aa-8801-e32b80394b9d " __DATE__ ;
static char __buildInfo[] = "FileAttributesPlugin FileAttributesPlugin.oscog-akg.49 uuid: 00b4eed5-b2a8-454a-90b7-c3662d7c5423 " __DATE__ ;



Expand Down Expand Up @@ -168,9 +168,9 @@ extern
struct VirtualMachine* interpreterProxy;
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
"FileAttributesPlugin FileAttributesPlugin.oscog-akg.47 (i)"
"FileAttributesPlugin FileAttributesPlugin.oscog-akg.49 (i)"
#else
"FileAttributesPlugin FileAttributesPlugin.oscog-akg.47 (e)"
"FileAttributesPlugin FileAttributesPlugin.oscog-akg.49 (e)"
#endif
;
static void * sCLPfn;
Expand Down Expand Up @@ -582,13 +582,13 @@ primitiveClosedir(void)
void *buffer;
sqInt dirPointerOop;
fapath *faPath;
fapathptr *faPathPtr;
FAPathPtr *faPathPtr;
sqInt result;
sqInt structSize;

dirPointerOop = stackValue(0);
/* begin structFromObject:size: */
structSize = sizeof(fapathptr);
structSize = sizeof(FAPathPtr);
if (!((stSizeOf(dirPointerOop)) == structSize)) {
primitiveFailFor(PrimErrBadArgument);
faPathPtr = ((void *) 0);
Expand All @@ -606,10 +606,10 @@ primitiveClosedir(void)
if (faPathPtr == 0) {
return primitiveFailFor(PrimErrBadArgument);
}
if (!(faValidateSessionId(faPathPtr->sessionId))) {
return primitiveFailFor(PrimErrBadArgument);
if (!(faValidateSessionId((faPathPtr->sessionId)))) {
return primitiveFailForOSError(-17 /* badSessionId */);
}
faPath = faPathPtr->faPath;
faPath = (faPathPtr->faPath);
result = faCloseDirectory(faPath);
faInvalidateSessionId(&faPathPtr->sessionId);
if (!(result == 0)) {
Expand Down Expand Up @@ -795,7 +795,7 @@ primitiveOpendir(void)
sqInt dirName;
sqInt dirOop;
fapath *faPath;
fapathptr faPathPtr;
FAPathPtr faPathPtr;
sqInt resultOop;
sqInt status;
sqInt structSize;
Expand Down Expand Up @@ -833,7 +833,7 @@ primitiveOpendir(void)
return primitiveFailureCode();
}
faInitSessionId(&faPathPtr.sessionId);
faPathPtr.faPath = faPath;
(faPathPtr.faPath = faPath);

#if SPURVM
/* begin objectFromStruct:size: */
Expand Down Expand Up @@ -925,14 +925,14 @@ primitiveReaddir(void)
void *buffer;
sqInt dirPointerOop;
fapath *faPath;
fapathptr *faPathPtr;
FAPathPtr *faPathPtr;
sqInt resultArray;
sqInt status;
sqInt structSize;

dirPointerOop = stackValue(0);
/* begin structFromObject:size: */
structSize = sizeof(fapathptr);
structSize = sizeof(FAPathPtr);
if (!((stSizeOf(dirPointerOop)) == structSize)) {
primitiveFailFor(PrimErrBadArgument);
faPathPtr = ((void *) 0);
Expand All @@ -950,10 +950,10 @@ primitiveReaddir(void)
if (faPathPtr == 0) {
return primitiveFailFor(PrimErrBadArgument);
}
if (!(faValidateSessionId(faPathPtr->sessionId))) {
if (!(faValidateSessionId((faPathPtr->sessionId)))) {
return primitiveFailForOSError(-17 /* badSessionId */);
}
faPath = faPathPtr->faPath;
faPath = (faPathPtr->faPath);
status = faReadDirectory(faPath);
if (status == 1 /* noMoreData */) {
return methodReturnValue(nilObject());
Expand All @@ -977,14 +977,14 @@ primitiveRewinddir(void)
void *buffer;
sqInt dirPointerOop;
fapath *faPath;
fapathptr *faPathPtr;
FAPathPtr *faPathPtr;
sqInt resultOop;
sqInt status;
sqInt structSize;

dirPointerOop = stackValue(0);
/* begin structFromObject:size: */
structSize = sizeof(fapathptr);
structSize = sizeof(FAPathPtr);
if (!((stSizeOf(dirPointerOop)) == structSize)) {
primitiveFailFor(PrimErrBadArgument);
faPathPtr = ((void *) 0);
Expand All @@ -1002,10 +1002,10 @@ primitiveRewinddir(void)
if (faPathPtr == 0) {
return primitiveFailFor(PrimErrBadArgument);
}
if (!(faValidateSessionId(faPathPtr->sessionId))) {
return primitiveFailFor(PrimErrBadArgument);
if (!(faValidateSessionId((faPathPtr->sessionId)))) {
return primitiveFailForOSError(-17 /* badSessionId */);
}
faPath = faPathPtr->faPath;
faPath = (faPathPtr->faPath);
status = faRewindDirectory(faPath);
if (status < 0) {
return primitiveFailForOSError(status);
Expand Down Expand Up @@ -1090,7 +1090,7 @@ primitiveSymlinkChangeOwner(void)
EXPORT(sqInt)
primitiveVersionString(void)
{
popthenPush(1, stringFromCString("2.0.7"));
popthenPush(1, stringFromCString("2.0.8"));
return 0;
}

Expand Down Expand Up @@ -1248,7 +1248,7 @@ sizeOfFaPath(void)
static sqInt
sizeOfFaPathPtr(void)
{
return sizeof(fapathptr);
return sizeof(FAPathPtr);
}


Expand Down

0 comments on commit 7b4dedb

Please sign in to comment.