Closed khuan013 closed 9 years ago
yeah, I'm having the same issue as well, as having other program issues when running rshell on the script vs running it on the regular terminal
If you don't report the error message, then there's no way for us to help you figure out what the problem is.
for me I don't get an error, it just doesn't show up on the script, my commands work find, everything works, but it just won't display the user and host name on the script, but it will if I run it on a regular terminal
also some of my error statements won't print in the script, for example if I ran la -a && echo hello it would attempt to run la -a and realize its an error and print out the error, but it won't run echo hello like its supposed to but won't print the associating error message but in an actual terminal it would
I get the perror message that checks if getlogin() returns NULL.
Error getting user name: No such file or directory
Apparently this is a known issue with getlogin
and the place in the OS it gets the login info from. It never happened in previous classes, so I wasn't aware of this.
Anyways, this stackoverflow question provides a suggested solution.
the suggested command there is a syscall within a syscall. is your error detection script going to dock points considering it's technically 2 calls with one perr output?
@2c2c It is common for people to write the shortest possible code that gets the job done. But you must have proper error checking on all syscalls. So you will have to extend their example code.
Apparently getuid
never fails so there's only one check to be made anyways. Shoulda checked both functions before I asked.
You're right! Forget what I said before.
The
getlogin()
function works fine on my computer, and on well and hammer, but if I'm running a script I get an error. And then unless I start a new terminal, it continues to give me an error.How can I fix this?