Why is listings' frame width a little larger then \textwidth?

Here is the sample code:

\documentclass[]{article}
\usepackage{listings}
\lstset{
basicstyle=\ttfamily\footnotesize,
frame=single, % adds a frame around the code
}
\begin{document}
\setlength{\fboxsep}{0pt}
\noindent\makebox[\linewidth]{\rule{\textwidth}{1pt}}
abc

\begin{lstlisting}
abc
\end{lstlisting}

\end{document}


And the screen shot of the result:

Even I set the \fboxsep to zero, I still get the same result. Are there any way to make it a little smaller?

Since I have many tables and lstlisting frames in my tex code, I want all their width to be the same. For tables, its width can be set corrctly by tabularx package, such as \begin{tabularx}{\textwidth}.... But I don't know an idea to correctly set the lstlisting's frame width.

The frame is put outside of the listings. Therefore xleftmargin and xrightmargin can be used to leave room for the frame. The default for framesep is 3pt and the default for framerule is 0.4pt.

Result:

\documentclass[]{article}
\usepackage{listings}
\lstset{
basicstyle=\ttfamily\footnotesize,
frame=single, % adds a frame around the code
xleftmargin=3.4pt,
xrightmargin=3.4pt,
}
\begin{document}
\noindent\makebox[\linewidth]{\rule{\textwidth}{1pt}}
abc

\begin{lstlisting}
abc
\end{lstlisting}

\end{document}