Section 15-21-25
Remand or commitment to custody or restraint for public offense when commitment irregular.
In habeas corpus proceedings, if it appears that the party has been legally committed for any public offense or that he is guilty of such an offense, although his commitment was irregular, he may be remanded to the custody or restraint from which he was taken if the person under whose custody or restraint he was is legally entitled thereto; but, if not so entitled, he must be committed to the custody or restraint of the proper officer or person.
(Code 1852, §736; Code 1867, §4287; Code 1876, §4963; Code 1886, §4786; Code 1896, §4839; Code 1907, §7034; Code 1923, §4333; Code 1940, T. 15, §29.)