Index: wp-includes/link-template.php
===================================================================
--- wp-includes/link-template.php	(revision 13020)
+++ wp-includes/link-template.php	(working copy)
@@ -107,7 +107,7 @@
 	elseif ( $post->post_type == 'attachment' )
 		return get_attachment_link($post->ID);
 	elseif ( in_array($post->post_type, get_post_types( array('_builtin' => false) ) ) )
-		return get_post_link($post);
+		return get_post_permalink($post);
 
 	$permalink = get_option('permalink_structure');
 
@@ -171,7 +171,7 @@
  * @param bool $sample Optional, defaults to false. Is it a sample permalink.
  * @return string
  */
-function get_post_link( $id = 0, $leavename = false, $sample = false  ) {
+function get_post_permalink( $id = 0, $leavename = false, $sample = false ) {
 	global $wp_rewrite;
 
 	$post = &get_post($id);
@@ -183,15 +183,17 @@
 
 	$slug = $post->post_name;
 
-	if ( !empty($post_link) && ( ( isset($post->post_status) && 'draft' != $post->post_status && 'pending' != $post->post_status ) || $sample ) ) {
+	$draft_or_pending = 'draft' == $post->post_status || 'pending' == $post->post_status;
+
+	if ( !empty($post_link) && ( ( isset($post->post_status) && !$draft_or_pending ) || $sample ) ) {
 		$post_link = ( $leavename ) ? $post_link : str_replace("%$post->post_type%", $slug, $post_link);
 		$post_link = home_url( user_trailingslashit($post_link) );
 	} else {
 		$post_type = get_post_type_object($post->post_type);
-		if ( $post_type->query_var && ( isset($post->post_status) && 'draft' != $post->post_status && 'pending' != $post->post_status ) )
-			$post_link = "?$post_type->query_var=$slug";
+		if ( $post_type->query_var && ( isset($post->post_status) && !$draft_or_pending ) )
+			$post_link = add_query_arg($post_type->query_var, $slug, '');
 		else
-			$post_link = "?post_type=$post->post_type&p=$post->ID";
+			$post_link = add_query_arg(array('post_type' => $post->post_type, 'p' => $post->ID), '');
 		$post_link = home_url($post_link);
 	}
 
