Desiccation resistance is an adaptive life-history trait dependent upon cuticular hydrocarbons, and influenced by mating status and temperature in D. melanogaster.