zsh bus error on C code under Monterey

I have some C99 code that worked fine under Catalina in XCODE and in TERMINAL


The code opens an existing file and reads the content to EOF

The code the creates a file and writes a standard message to the created file


I migrated to a new Macbook Pro with Monterey... and the same code


always displays the correct file name to open but then fails to open it, displaying

a NULL FILE pointer and "zsh: bus error" with the full program pathname


The code is executing under TERMINAL and the code executable an file are in the same folder


Posted on Sep 26, 2022 6:53 AM

Reply
3 replies

Sep 26, 2022 2:46 PM in response to Luis Sequeira1

Replying again.... the executable and the files are all in the folder Desktop/ENIGMA/... I've tried null paths and all possible paths to this folder... the file I create and write to still works; however, the pre-existing file I try to open in order to read returns a NULL pointer to

"FILE pointer = open( filename, "r");.... the the zsh: bus error.


I'll executable and all files on a thumb drive to see how that works.


--Scott

Sep 26, 2022 5:06 PM in response to bobscott

Replying again.... the executable and the files are all in the folder Desktop/ENIGMA/... I've tried null paths and all possible paths to this folder...

If it never asked you for permission, then it is likely getting a null pointer because it doesn't have access to those files.

You could try giving the app Full Disk Access in Security & Privacy system preferences.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

zsh bus error on C code under Monterey

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.