Commit graph

22 commits

Author SHA1 Message Date
anthraxx
4a28a8debd some manual (unnecessery) free for good manner
its not needed because OS is responsible to cleanup
mem allocated by terminating process, but its still
a good manner to explicitly free everything that gets
allocated...
yes this is "noise" if it terminates but neither does
harm to feel being responsible to clean up everything
ourselves. :)

at least valgrind is silently happy :P :D
2014-06-10 23:14:29 +02:00
anthraxx
76942f6933 C90 compilant commenting style 2014-06-10 22:56:01 +02:00
496ebd1158 Merge branch 'develop' into 'master'
nitpicking and better c standard compliant code

let us...

...use the proper main(void) signature.

...use variable names which speak for their semantic content not their type, as types are explicitly declared.

...use perror() to signal the correct errno message upon error.

...move the password out of the running code, so we can change and find it easily.

...use exit() as it's a linear CLI tool, which can and should exit on certain failure/error states.

...decouple error handling from business logic. (e.g. getline() error handling and strcmp() for password check).

...not free() at the end of the program as it **is** and should **never** be necessary, since the OS **must** handle this.
2014-06-10 20:45:25 +00:00
Oliver Feldt
297863493f nitpicking and better c standard compliant code 2014-06-10 22:22:10 +02:00
e315738b37 Merge branch 'master' into 'master'
using printf to avoid \n for pwd input message

newline after "Please enter Password: " looks strange
2014-06-10 13:44:25 +00:00
anthraxx
586fa66c35 using printf to avoid \n for pwd input message 2014-06-10 15:42:14 +02:00
0e62272c44 Merge branch 'master' into 'master'
memleak bugfix + cleanup + Makefile

- memleak bugfix as free() was missing
- dont call malloc() manually (the old way getline() always called realloc() anyway because of the way the malloc() was written [did not allocate enought memory for the string])
- small minor cleanup
- adding simple Makefile to build door challenge
2014-06-10 13:35:19 +00:00
anthraxx
e5931c0a41 adding simple makefile to build door challenge 2014-06-10 15:15:25 +02:00
anthraxx
6128aef57a adding +x to shell-scripts 2014-06-10 14:00:21 +02:00
anthraxx
6a3da8153d rename my_string to input_str for better naming 2014-06-10 13:03:34 +02:00
anthraxx
ea0b0d95e6 reduce complexity + just free() in a single place
- therefor if the program gets extended, its unlikly that
  someone will forget to call free()
- also this gets rid of copy-paste free() calls (which look stupid)
2014-06-10 13:01:34 +02:00
anthraxx
bf5f98649d explicitly import string.h for strcmp()
- implicitly declaring library function is bad manner :)
2014-06-10 12:47:40 +02:00
anthraxx
320c09285c fixing memleak of input char*
- adding missing free() calls
- dont malloc ourselves as getline() also does a malloc
  (and anyway called realloc before if the size_t was
   smaller then the actual len(input-line) to behaviour
   is the same!)
2014-06-10 12:45:25 +02:00
295b44aff4 remove trailing spaces 2014-06-07 18:40:16 +02:00
ff17c7f33e add trailing spaces 2014-06-07 18:39:45 +02:00
03f9a6ff60 removed debug outputs 2014-06-07 18:36:07 +02:00
efc93bdc6a Added little c-Script to ask for a Password 2014-06-07 18:21:13 +02:00
2a81047145 Added .gitignore File 2014-06-07 18:20:45 +02:00
74a2f637b7 readme format fix 2014-06-06 13:52:30 +02:00
bfb7ee68e4 extended readme 2014-06-06 13:51:46 +02:00
8a9790be72 added readme 2014-06-06 13:51:03 +02:00
33314ad2a5 Initial commit with current scripts 2014-06-06 13:48:56 +02:00