Reliever Jean Machi and the San Francisco Giants took advantage of a huge baserunning blunder by Pittsburgh, tagging out two runners who wandered away on the same play and beating the Pirates 7-5 on Wednesday to end a six-game losing streak.