Any person owning or occupying land adjoining any railroad track of any railroad company shall have the right to attach to the fence constructed along the track or right-of-way of said railroad company any wires, boards or other materials so as to make the fence of said railroad company sufficient to prevent any hogs or pigs from getting upon the track of said railroad company.