It is the duty of all jailers, on demand of the officer in charge of any convict being conveyed to the penitentiary, to receive and safely keep such convict for the legal charge of feeding prisoners whenever such officer may deem it necessary to have him secured for the night or for any longer time they may be necessarily detained.