Cardiff ended their three-match losing run in the Championship but only after holding off a valiant second-half fightback from managerless Lincoln at the Cardiff City Stadium.