Raft with castaways

A merchant ship is smashed against a rock. Some survivors (two soldiers and a sailor) find themselves hanging onto a part of the deck.
They manage to find a large number of empty barrels, as well as some spars and a small sail, and use them to create a raft.
Afterwards they spend a long time drifting trying to sail in the direction of civilization.