This is a discussion on You know you've had to much to drink, when.... within the Slackware Linux Support forums, part of the Unix Operating Systems category; --> ....you keep entering cu - and still don't get root access and spend 40 more minutes trying to figure ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| notbob wrote: > ...you keep entering cu - and still don't get root access and spend 40 > more minutes trying to figure out why. > > Damn $2CHK! > How 'bout a diff to su: if isWorking(/dev/breathalizer) { int number = user->blow() if (number > .08) { printf("No root for you!\n") exit(1); } } |
| |||
| On 2007-08-15, Chris Sorenson <csoren@isd.net> wrote: > How 'bout a diff to su: > > if isWorking(/dev/breathalizer) > { > int number = user->blow() > > if (number > .08) { > printf("No root for you!\n") > exit(1); > } > } LOL!..... nb |
| |||
| -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Chris Sorenson wrote: > if (number > .08) { > printf("No root for you!\n") > exit(1); I got a "breathalizer" from my mother recently (still can't figure out why) and it's some El Cheapo Chinese model that has just two LEDs (one of them two-color). When the two-color one goes red, you're drunk (or something like that). So just a binary operation would be needed: if isWorking(/dev/breathalizer) { bool number = user->blow() if (number = 1) { printf("No root for you!\n") exit(1); } } (Sorry for any mistakes, I can't speak C at all Yeti - -- This message is best viewed with open eyes. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGxDq9Py/9LATNIMwRAvi5AJwO1EC9sudFpd14ug/7z4Xz+GK4pgCdHyHw bBiIdSlF/q1FkELqmASdL74= =dE4T -----END PGP SIGNATURE----- |
| |||
| "Yeti" typed: > if isWorking(/dev/breathalizer) > { > bool number = user->blow() > > if (number = 1) { > printf("No root for you!\n") > exit(1); > } > } With that, you will always be found to be drunk (and without root). -- Ayaz Ahmed Khan |
| |||
| Thu, 16 Aug 2007 17:04:25 +0500, Ayaz Ahmed Khan did catÂ*: > "Yeti" typed: > >> if isWorking(/dev/breathalizer) >> { >> bool number = user->blow() >> >> if (number = 1) { >> printf("No root for you!\n") >> exit(1); >> } >> } > > With that, you will always be found to be drunk (and without root). which from this shown tendency to test variables out of scope and use assignments in place of tests is probably safer ;-) Personally my foolproof test to check if I'd better not use 'root' is to try and open a file: # vi smurf if I get this output I know I'm well done:-) smurf,v <-- smurf ci: smurf: No such file or directory |
| |||
| Loki Harfagr wrote: > Thu, 16 Aug 2007 17:04:25 +0500, Ayaz Ahmed Khan did cat : > > >>"Yeti" typed: >> >> >>>if isWorking(/dev/breathalizer) >>>{ >>> bool number = user->blow() >>> >>> if (number = 1) { >>> printf("No root for you!\n") >>> exit(1); >>> } >>>} >> >>With that, you will always be found to be drunk (and without root). > > > which from this shown tendency to test variables out of scope > and use assignments in place of tests is probably > safer ;-) > Plus there's no bool data type in C (C++ yes but that sucks and is evil!). Everyone missed the boo-boo in my initial code, number should have been declared float not int... > Personally my foolproof test to check if I'd better not > use 'root' is to try and open a file: > > # vi smurf > > if I get this output I know I'm well done:-) > > smurf,v <-- smurf > ci: smurf: No such file or directory That would work for me because I'd never try to use vi unless I was already quite inebriated! |
| |||
| Chris Sorenson wrote: > .... snip ... >>> >>>> if isWorking(/dev/breathalizer) { >>>> bool number = user->blow() >>>> >>>> if (number = 1) { >>>> printf("No root for you!\n") >>>> exit(1); >>>> } >>>> } .... snip ... > > Everyone missed the boo-boo in my initial code, number should > have been declared float not int... Then the equality test (assuming a mistype) is very iffy. -- Chuck F (cbfalconer at maineline dot net) Available for consulting/temporary embedded and systems. <http://cbfalconer.home.att.net> -- Posted via a free Usenet account from http://www.teranews.com |
| ||||
| On Aug 17, 3:05 pm, CBFalconer <cbfalco...@yahoo.com> wrote: > >>>> if (number = 1) { > > Then the equality test (assuming a mistype) is very iffy. > Yup, Yeti made that change and it is a mistype. Ayaz caught it too. Since Yeti changed it to a bool all he needed is 'if(number)' |