Allow him to sniff you before you reach to pet him. Spend time playing with and caring for your dog. Pets often guard their food, their babies, and their toys. A dog's natural instinct is to chase after something that's running from it. Instead, stand still, let the dog sniff you, and continue to be still and quiet till the dog walks away and leaves you alone.
Unneutered dogs are generally more likely to bite.
Instead, tell an adult about the animal. If a dog shows any signs of aggressiveness toward you, report it to the dogs owner, or to animal control. Unreported incidents only increase the likelihood that this will happen to others. This lets the dog know that you have not gotten its message, and it will probably get more aggressive with further approaches. This is a sure way to worsen the wound you receive.