If there is a '\n' before the '=' (maybe the data's corrupt) you're going to have a '\n' in your name.  I suggest [^=\n] as the first character set.
You should look at the return from sscanf and check that it's 2; if it isn't, you didn't find an = in the line, so you can't sensibly process what you've collected.